This commit is contained in:
xavier.beaudouin
2015-10-06 17:41:52 +02:00
13 changed files with 157 additions and 49 deletions
+1
View File
@@ -58,5 +58,6 @@ Contributors to LibreNMS:
- Mark Nagel <mnagel@willingminds.com> (ciscoqid)
- Sławomir Paszkiewicz <paszczus@pld-linux.org> (paszczus)
- Frederik Mogensen <frederik@server-1.dk> (mogensen)
- Matthew Scully <matt@mattz0r.me.uk> (mattz0r)
[1]: http://observium.org/ "Observium web site"
+3 -3
View File
@@ -66,7 +66,7 @@ __Conditions__ can be any of:
__Values__ can be Entities or any single-quoted data.
__Glues__ can be either `&&` for `AND` or `||` for `OR`.
__Note__: The difference between `Equals` and `Matches` (and it's negation) is that `Equals` does a strict comparison and `Matches` allows the usage of RegExp.
__Note__: The difference between `Equals` and `Matches` (and its negation) is that `Equals` does a strict comparison and `Matches` allows the usage of RegExp.
Arithmetics are allowed as well.
## <a name="rules-examples">Examples</a>
@@ -145,7 +145,7 @@ To include users that have `Global-Read` or `Administrator` permissions it is re
~
```php
$config['alert']['globals'] = true; //Include Global-Read into alert-contacts
$config['alert']['admins'] = true; //Include Adminstrators into alert-contacts
$config['alert']['admins'] = true; //Include Administrators into alert-contacts
```
~~
@@ -374,7 +374,7 @@ $config['alert']['transports']['pushbullet'] = 'MYFANCYACCESSTOKEN';
# <a name="entities">Entities
Entities as described earlier are based on the table and column names within the database, if you are ensure of what the entity is you want then have a browse around inside MySQL using `show tables` and `desc <tablename>`.
Entities as described earlier are based on the table and column names within the database, if you are unsure of what the entity is you want then have a browse around inside MySQL using `show tables` and `desc <tablename>`.
## <a name="entity-devices">Devices</a>
+1
View File
@@ -23,6 +23,7 @@ Option | Default-Value | Notes
--- | --- | ---
`$config['irc_alert']` | `false` | Optional; Enables Alerting-Socket. `EXPERIMENTAL`
`$config['irc_alert_chan']` | `false` | Optional; Multiple channels can be defined as Array or delimited with `,`. `EXPERIMENTAL`
`$config['irc_alert_utf8']` | `false` | Optional; Enables use of strikethrough in alerts via UTF-8 encoded characters. Might cause trouble for some clients.
`$config['irc_authtime']` | `3` | Optional; Defines how long in Hours an auth-session is valid.
`$config['irc_chan']` | `##librenms` | Optional; Multiple channels can be defined as Array or delimited with `,`
`$config['irc_debug']` | `false` | Optional; Enables debug output (Wall of text)
+92 -10
View File
@@ -1,4 +1,4 @@
NOTE: What follows is a very rough list of commands. This works on a fresh install of CentOS 6.4.
NOTE: What follows is a very rough list of commands. This works on a fresh install of CentOS 6.4 and CentOS 7.
NOTE: These instructions assume you are the root user. If you are not, prepend `sudo` to all shell commands (the ones that aren't at `mysql>` prompts) or temporarily become a user with root privileges with `sudo -s`.
@@ -8,6 +8,7 @@ This host is where the MySQL database runs. It could be the same machine as you
> ** Whilst we are working on ensuring LibreNMS is compatible with MySQL strict mode, for now, please disable this after mysql is installed.
**CentOS 6**:
You are free to choose between using MySQL or MariaDB:
**MySQL**
@@ -24,11 +25,30 @@ chkconfig mariadb on
service mariadb start
```
**CentOS 7**
(NOTE: In CentOS 7 there is only mariadb in official repo)
**MariaDB**
```bash
yum install net-snmp mariadb-server mariadb-client
systemctl enable mariadb
systemctl start mariadb
```
Now continue with the installation:
**CentOS 6**
```bash
service snmpd start
chkconfig snmpd on
service snmpd start
mysql_secure_installation
mysql -uroot -p
```
**CentOS 7**
```bash
systemctl enable snmpd
systemctl start snmpd
mysql_secure_installation
mysql -uroot -p
```
@@ -69,22 +89,43 @@ Install necessary software. The packages listed below are an all-inclusive list
Note if not using HTTPd (Apache): RHEL requires `httpd` to be installed regardless of of `nginx`'s (or any other web-server's) presence.
**CentOS 6**
```bash
yum install epel-release
yum install php php-cli php-gd php-mysql php-snmp php-pear php-curl httpd net-snmp graphviz graphviz-php mysql ImageMagick jwhois nmap mtr rrdtool MySQL-python net-snmp-utils vixie-cron php-mcrypt fping git
pear install Net_IPv4-1.3.4
pear install Net_IPv6-1.2.2b2
```
### Adding the librenms-user ###
**CentOS 7**
```bash
yum install php php-cli php-gd php-mysql php-snmp php-pear php-curl httpd net-snmp graphviz graphviz-php mariadb ImageMagick jwhois nmap mtr rrdtool MySQL-python net-snmp-utils vixie-cron php-mcrypt fping git
pear install Net_IPv4-1.3.4
pear install Net_IPv6-1.2.2b2
```
### Adding the librenms-user for Apache ###
```bash
useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms apache
```
### Adding the librenms-user for Nginx ###
```bash
useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms nginx
```
### Using HTTPd (Apache2) ###
Set `httpd` to start on system boot.
**CentOS 6**
chkconfig --levels 235 httpd on
**CentOS 7**
systemctl enable httpd
Next, add the following to `/etc/httpd/conf.d/librenms.conf`
```apache
@@ -109,14 +150,25 @@ If the file `/etc/httpd/conf.d/welcome.conf` exists, you might want to remove th
Install necessary extra software and let it start on system boot.
**CentOS 6**
```bash
yum install nginx php-fpm
chkconfig nginx on
chkconfig php-fpm on
```
**CentOS 7**
```bash
yum install nginx php-fpm
systemctl enable nginx
systemctl enable php-fpm
```
Modify permissions and configuration for `php-fpm` to use nginx credentials.
mkdir /var/lib/php/session
chown root:nginx /var/lib/php -R
vi /etc/php-fpm.d/www.conf # At line #12: Change `listen` to `/var/run/php5-fpm.sock`
vim /etc/php-fpm.d/www.conf # At line #12: Change `listen` to `/var/run/php5-fpm.sock`
# At line #39-41: Change the `user` and `group` to `nginx`
Add configuration for `nginx` at `/etc/nginx/conf.d/librenms.conf` with the following content:
@@ -151,15 +203,19 @@ server {
You can clone the repository via HTTPS or SSH. In either case, you need to ensure the appropriate port (443 for HTTPS, 22 for SSH) is open in the outbound direction for your server.
```bash
cd /opt
git clone https://github.com/librenms/librenms.git librenms
cd /opt/librenms
```
At this stage you can either launch the web installer by going to http://IP/install.php, follow the on-screen instructions then skip to the 'Web Interface' section further down. Alternatively if you want
to continue the setup manually then just keep following these instructions.
```bash
cp config.php.default config.php
vim config.php
```
NOTE: The recommended method of cloning a git repository is HTTPS. If you would like to clone via SSH instead, use the command `git clone git@github.com:librenms/librenms.git librenms` instead.
@@ -193,24 +249,53 @@ To prepare the web interface (and adding devices shortly), you'll need to create
First, create and chown the `rrd` directory and create the `logs` directory
```bash
mkdir rrd logs
chown -R librenms:librenms /opt/librenms
chmod 775 rrd
# For HTTPd (Apache):
chown apache:apache logs
# For Nginx:
chown nginx:nginx logs
chmod 775 rrd
```
> If you're planing on running rrdcached, make sure that the path is also chmod'ed to 775 and chown'ed to librenms:librenms.
**SELinux**
> if you're using SELinux you need to allow web server user to write into logs directory.
> semanage tool is a part of policycoreutils-python, so if don't have it, you can install it
> **Please note that running LibreNMS with SELinux is still experimental and we cannot guarantee that everything will be working fine for now.**
```bash
yum install policycoreutils-python
```
```bash
semanage fcontext -a -t httpd_sys_content_t '/opt/librenms/logs(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/opt/librenms/logs(/.*)?'
restorecon -RFvv /opt/librenms/logs/
```
Start the web-server:
**CentOS 6**
# For HTTPd (Apache):
service httpd restart
# For Nginx:
service nginx restart
**CentOS 7**
# For HTTPd (Apache):
systemctl restart httpd
# For Nginx:
systemctl restart nginx
### Add localhost ###
php addhost.php localhost public v2c
@@ -223,10 +308,7 @@ Discover localhost:
### Create cronjob ###
The polling method used by LibreNMS is `poller-wrapper.py`, which was placed in
the public domain by its author. By default, the LibreNMS cronjob runs `poller-
wrapper.py` with 16 threads. The current LibreNMS recommendation is to use 4 th
reads per core. The default if no thread count is `16 threads`.
The polling method used by LibreNMS is `poller-wrapper.py`, which was placed in the public domain by its author. By default, the LibreNMS cronjob runs `poller-wrapper.py` with 16 threads. The current LibreNMS recommendation is to use 4 threads per core. The default if no thread count is `16 threads`.
If the thread count needs to be changed, you can do so by editing the cron file (`/etc/cron.d/librenms`).
Just add a number after `poller-wrapper.py`, as in the below example:
+2 -2
View File
@@ -22,7 +22,7 @@
This is currently well documented within the doc folder of the installation files.
For Debian / Ubuntu installs follow [Debian / Ubuntu](http://docs.librenms.org/Installation/Installation-(Debian-Ubuntu)
For Debian / Ubuntu installs follow [Debian / Ubuntu](http://docs.librenms.org/Installation/Installation-(Debian-Ubuntu))
For RedHat / CentOS installs follow [RedHat / CentOS](http://docs.librenms.org/Installation/Installation-(RHEL-CentOS))
@@ -60,7 +60,7 @@ However we will always aim to help wherever possible so if you are running a dis
#### <a name="faq5"> Do you have a demo available?</a>
We do indeed, you can find access to the demo [here](demo.librenms.org)
We do indeed, you can find access to the demo [here](https://demo.librenms.org)
#### <a name="faq6"> Why do I get blank pages sometimes in the WebUI?</a>
+4
View File
@@ -1761,3 +1761,7 @@ tr.search:nth-child(odd) {
.edit-storage-input {
width: 100px;
}
label {
font-weight: normal;
}
+12 -10
View File
@@ -51,7 +51,7 @@ else {
<ul class="dropdown-menu">
<li><a href="<?php echo(generate_url(array('page'=>'overview'))); ?>"><i class="fa fa-lightbulb-o fa-fw fa-lg"></i> Overview</a></li>
<li class="dropdown-submenu">
<a><i class="fa fa-exclamation-circle fa-fw fa-lg"> </i>Alerts</a>
<a><i class="fa fa-exclamation-circle fa-fw fa-lg"> </i> Alerts</a>
<ul class="dropdown-menu scrollable-menu">
<li><a href="<?php echo(generate_url(array('page'=>'alerts'))); ?>"><i class="fa fa-bell fa-fw fa-lg"></i> Notifications</a></li>
<li><a href="<?php echo(generate_url(array('page'=>'alert-log'))); ?>"><i class="fa fa-th-list fa-fw fa-lg"></i> Historical Log</a></li>
@@ -129,16 +129,18 @@ foreach (dbFetchRows($sql,$param) as $devtype) {
echo(' <li><a href="devices/type=' . $devtype['type'] . '/"><i class="fa fa-angle-double-right fa-fw fa-lg"></i> ' . ucfirst($devtype['type']) . '</a></li>');
}
require_once '../includes/device-groups.inc.php';
foreach( GetDeviceGroups() as $group ) {
echo '<li><a href="'.generate_url(array('page'=>'devices','group'=>$group['id'])).'" alt="'.$group['desc'].'"><i class="fa fa-th fa-fw fa-lg"></i> '.ucfirst($group['name']).'</a></li>';
}
unset($group);
echo ('</ul>
</li>');
require_once '../includes/device-groups.inc.php';
$devices_groups = GetDeviceGroups();
if (count($devices_groups) > 0 ){
echo '<li class="dropdown-submenu"><a href="#"><i class="fa fa-th fa-fw fa-lg"></i> Device Groups</a><ul class="dropdown-menu scrollable-menu">';
foreach( $devices_groups as $group ) {
echo '<li><a href="'.generate_url(array('page'=>'devices','group'=>$group['id'])).'" alt="'.$group['desc'].'"><i class="fa fa-th fa-fw fa-lg"></i> '.ucfirst($group['name']).'</a></li>';
}
unset($group);
echo '</ul></li>';
}
if ($_SESSION['userlevel'] >= '10') {
if ($config['show_locations']) {
echo('
@@ -529,7 +531,7 @@ if ($_SESSION['userlevel'] >= '10') {
</ul>
</li>
<li role="presentation" class="divider"></li>');
}
}
if ($_SESSION['authenticated']) {
echo('
+5 -8
View File
@@ -42,14 +42,6 @@ else {
$msg_box[] = array('type'=>'error','message'=>$auth_message,'title'=>'Login error');
}
?>
<?php
if (isset($config['login_message'])) {
echo('
<div class="form-group">
<div class="alert alert-info text-center">'.$config['login_message'].'</div>
</div>');
}
?>
</form>
<script type="text/javascript">
<!--
@@ -61,6 +53,11 @@ else {
?>
</div>
</div>
<?php
if (isset($config['login_message'])) {
echo('<div class="panel-footer"><center>'.$config['login_message'].'</center></div>');
}
?>
</div>
</div>
<div class="col-md-4"></div>
+11 -10
View File
@@ -501,16 +501,17 @@ $config['device_traffic_descr'][] = '/null/';
$config['device_traffic_descr'][] = '/dummy/';
// IRC Bot configuration
$config['irc_host'] = '';
$config['irc_port'] = '';
$config['irc_maxretry'] = 3;
$config['irc_nick'] = $config['project_name'];
$config['irc_chan'][] = '##'.$config['project_id'];
$config['irc_pass'] = '';
$config['irc_external'] = '';
$config['irc_authtime'] = 3;
$config['irc_debug'] = false;
$config['irc_alert'] = false;
$config['irc_host'] = '';
$config['irc_port'] = '';
$config['irc_maxretry'] = 3;
$config['irc_nick'] = $config['project_name'];
$config['irc_chan'][] = '##'.$config['project_id'];
$config['irc_pass'] = '';
$config['irc_external'] = '';
$config['irc_authtime'] = 3;
$config['irc_debug'] = false;
$config['irc_alert'] = false;
$config['irc_alert_utf8'] = false;
// Authentication
$config['allow_unauth_graphs'] = 0;
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
if (!$os) {
if (preg_match('/^WatchGuard\ Fireware/', $sysDescr)) {
if (preg_match('/^WatchGuard\ Fireware/', $sysDescr) || strpos($sysObjectId, '1.3.6.1.4.1.3097.1.5') !== false) {
$os = 'firebox';
}
}
+8 -1
View File
@@ -191,7 +191,7 @@ function rrdtool($command, $filename, $options) {
print $console_color->convert('RRD[%g'.$cmd.'%n] ');
}
else {
$tmp = stream_get_contents($rrd_pipes[1]).stream_get_contents($rrd_pipes[2]);
return array(stream_get_contents($rrd_pipes[1]),stream_get_contents($rrd_pipes[2]));
}
}
@@ -206,6 +206,13 @@ function rrdtool($command, $filename, $options) {
function rrdtool_create($filename, $options) {
global $config;
if( $config['rrdcached'] && $config['rrdtool_version'] >= 1.5 ) {
$chk = rrdtool('info', $filename, '');
if (!empty($chk[0])) {
return true;
}
}
return rrdtool('create', $filename, str_replace(array("\r", "\n"), '', $options));
}
+16 -4
View File
@@ -74,7 +74,6 @@ class ircbot {
$this->sql = $database_link;
}
$this->j = 2;
$this->config = $config;
$this->debug = $this->config['irc_debug'];
$this->config['irc_authtime'] = $this->config['irc_authtime'] ? $this->config['irc_authtime'] : 3;
@@ -150,6 +149,8 @@ class ircbot {
$this->connect_alert();
}
$this->j = 2;
$this->connect();
$this->log('Connected');
if ($this->pass) {
@@ -159,7 +160,7 @@ class ircbot {
$this->doAuth();
while (true) {
foreach ($this->socket as $n => $socket) {
if (!is_resource($socket)) {
if (!is_resource($socket) || feof($socket)) {
$this->log("Socket '$n' closed. Restarting.");
break 2;
}
@@ -227,9 +228,20 @@ class ircbot {
return false;
}
switch ($alert['state']):
case 3: $severity_extended = '+'; break;
case 4: $severity_extended = '-'; break;
default: $severity_extended = '';
endswitch;
$severity = str_replace(array('warning', 'critical'), array(chr(3).'8Warning', chr(3).'4Critical'), $alert['severity']).$severity_extended.chr(3).' ';
if ($alert['state'] == 0 and $this->config['irc_alert_utf8']) {
$severity = str_replace(array('Warning', 'Critical'), array('W̶a̶r̶n̶i̶n̶g̶', 'C̶r̶i̶t̶i̶c̶a̶l̶'), $severity);
}
if ($this->config['irc_alert_chan']) {
foreach ($this->config['irc_alert_chan'] as $chan) {
$this->irc_raw('PRIVMSG '.$chan.' :'.trim($alert['title']).' - Rule: '.trim($alert['name'] ? $alert['name'] : $alert['rule']).(sizeof($alert['faults']) > 0 ? ' - Faults:' : ''));
$this->irc_raw('PRIVMSG '.$chan.' :'.$severity.trim($alert['title']).' - Rule: '.trim($alert['name'] ? $alert['name'] : $alert['rule']).(sizeof($alert['faults']) > 0 ? ' - Faults:' : ''));
foreach ($alert['faults'] as $k => $v) {
$this->irc_raw('PRIVMSG '.$chan.' :#'.$k.' '.$v['string']);
}
@@ -238,7 +250,7 @@ class ircbot {
else {
foreach ($this->authd as $nick => $data) {
if ($data['expire'] >= time()) {
$this->irc_raw('PRIVMSG '.$nick.' :'.trim($alert['title']).' - Rule: '.trim($alert['name'] ? $alert['name'] : $alert['rule']).(sizeof($alert['faults']) > 0 ? ' - Faults'.(sizeof($alert['faults']) > 3 ? ' (showing first 3 out of '.sizeof($alert['faults']).' )' : '' ).':' : ''));
$this->irc_raw('PRIVMSG '.$nick.' :'.$severity.trim($alert['title']).' - Rule: '.trim($alert['name'] ? $alert['name'] : $alert['rule']).(sizeof($alert['faults']) > 0 ? ' - Faults'.(sizeof($alert['faults']) > 3 ? ' (showing first 3 out of '.sizeof($alert['faults']).' )' : '' ).':' : ''));
foreach ($alert['faults'] as $k => $v) {
$this->irc_raw('PRIVMSG '.$nick.' :#'.$k.' '.$v['string']);
if ($k >= 3) {
+1
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
/*
* LibreNMS