mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
erge branch 'master' into thecityofguanyu/add-calix-e5-support
This commit is contained in:
16
.github/ISSUE_TEMPLATE.md
vendored
16
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,17 +1,11 @@
|
||||
#### Please note
|
||||
|
||||
> Please read this information and delete it once ready.
|
||||
> Please read this information carefully.
|
||||
|
||||
- Ensure that your install is upto date before submitting an issue. You can ensure you are upto date by running `./daily.sh` as the librenms user. If you experience errors updating then please run `./validate.php`.
|
||||
[ ] Is your install up to date? [Updating your install](http://docs.librenms.org/General/Updating/)
|
||||
|
||||
- If your issue is a request for us to add a new device then please ensure you provide the following information as pastebin links.
|
||||
[ ] Please include all of the information between the `====================================` section of `./validate.php`.
|
||||
|
||||
Please replace the relevant information in these commands.
|
||||
[ ] If you would like us to add a new device then please provide the information asked for [here](http://docs.librenms.org/Support/FAQ/#faq20)
|
||||
|
||||
```bash
|
||||
./discovery.php -h HOSTNAME -d -m os
|
||||
./poller.php -h HOSTNAME -r -f -d -m os
|
||||
snmpbulkwalk -On -v2c -c COMMUNITY HOSTNAME .
|
||||
```
|
||||
|
||||
If possible please also provide what the OS name should be if it doesn't exist already.
|
||||
[ ] Please provide as much detail as possible.
|
||||
|
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#### Please note
|
||||
|
||||
> Please read this information carefully.
|
||||
|
||||
[ ] Have you signed the [Contributors agreement](http://docs.librenms.org/General/Contributing/)
|
||||
|
||||
[ ] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)
|
@@ -106,11 +106,15 @@ LibreNMS contributors:
|
||||
- Marc Runkel <marc@runkel.org> (mrunkel)
|
||||
- Josh Driver <keeperofdakeys@gmail.com> (keeperofdakeys)
|
||||
- Felix Eckhofer <felix@eckhofer.com> (tribut)
|
||||
- Vikram Adukia <adukia@dropbox.com> (justmedude)
|
||||
- Vikram Adukia <adukia@dropbox.com> (justmedude)
|
||||
- Tijmen de Mes <tijmen@ag-projects.com> (tijmenNL)
|
||||
- Benjamin Busche <benjamin.busche@gmail.com> (optic00)
|
||||
- Brandon Boudrias <bt.boudrias@gmail.com> (brandune)
|
||||
- Andy Noyland <andrew@noyland.co.uk> (Zappatron)
|
||||
- Andy Noyland <andrew@noyland.co.uk> (Zappatron)
|
||||
- Cercel Valentin <crc@nuamchefazi.ro> (crcro)
|
||||
- Ahmed Sajid <ahmed4343@hotmail.com> (ahmedsajid)
|
||||
- Karsten Schmidt <git@guggemand.dk> (guggemand)
|
||||
- Florian Beer <fb@42dev.eu> (florianbeer)
|
||||
|
||||
[1]: http://observium.org/ "Observium web site"
|
||||
Observium was written by:
|
||||
|
99
addhost.php
99
addhost.php
@@ -27,9 +27,10 @@ if (isset($options['g']) && $options['g'] >= 0) {
|
||||
array_shift($argv);
|
||||
array_unshift($argv, $cmd);
|
||||
$poller_group = $options['g'];
|
||||
}
|
||||
else if ($config['distributed_poller'] === true) {
|
||||
} elseif ($config['distributed_poller'] === true) {
|
||||
$poller_group = $config['distributed_poller_group'];
|
||||
} else {
|
||||
$poller_group = 0;
|
||||
}
|
||||
|
||||
if (isset($options['f']) && $options['f'] == 0) {
|
||||
@@ -37,6 +38,8 @@ if (isset($options['f']) && $options['f'] == 0) {
|
||||
array_shift($argv);
|
||||
array_unshift($argv, $cmd);
|
||||
$force_add = 1;
|
||||
} else {
|
||||
$force_add = 0;
|
||||
}
|
||||
|
||||
$port_assoc_mode = $config['default_port_association_mode'];
|
||||
@@ -46,7 +49,7 @@ if (isset ($options['p'])) {
|
||||
if (! in_array ($port_assoc_mode, $valid_assoc_modes)) {
|
||||
echo "Invalid port association mode '" . $port_assoc_mode . "'\n";
|
||||
echo 'Valid modes: ' . join (', ', $valid_assoc_modes) . "\n";
|
||||
exit;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
$cmd = array_shift($argv);
|
||||
@@ -76,6 +79,7 @@ if (!empty($argv[1])) {
|
||||
'cryptoalgo' => 'AES',
|
||||
);
|
||||
|
||||
// v3
|
||||
if ($seclevel === 'nanp' or $seclevel === 'any' or $seclevel === 'noAuthNoPriv') {
|
||||
$v3['authlevel'] = 'noAuthNoPriv';
|
||||
$v3args = array_slice($argv, 4);
|
||||
@@ -84,11 +88,9 @@ if (!empty($argv[1])) {
|
||||
// parse all remaining args
|
||||
if (is_numeric($arg)) {
|
||||
$port = $arg;
|
||||
}
|
||||
else if (preg_match('/^('.implode('|', $config['snmp']['transports']).')$/', $arg)) {
|
||||
} elseif (preg_match('/^('.implode('|', $config['snmp']['transports']).')$/', $arg)) {
|
||||
$transport = $arg;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// should add a sanity check of chars allowed in user
|
||||
$user = $arg;
|
||||
}
|
||||
@@ -97,10 +99,7 @@ if (!empty($argv[1])) {
|
||||
if ($seclevel === 'nanp') {
|
||||
array_push($config['snmp']['v3'], $v3);
|
||||
}
|
||||
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
else if ($seclevel === 'anp' or $seclevel === 'authNoPriv') {
|
||||
} elseif ($seclevel === 'anp' or $seclevel === 'authNoPriv') {
|
||||
$v3['authlevel'] = 'authNoPriv';
|
||||
$v3args = array_slice($argv, 4);
|
||||
$v3['authname'] = array_shift($v3args);
|
||||
@@ -110,23 +109,18 @@ if (!empty($argv[1])) {
|
||||
// parse all remaining args
|
||||
if (is_numeric($arg)) {
|
||||
$port = $arg;
|
||||
}
|
||||
else if (preg_match('/^('.implode('|', $config['snmp']['transports']).')$/i', $arg)) {
|
||||
} elseif (preg_match('/^('.implode('|', $config['snmp']['transports']).')$/i', $arg)) {
|
||||
$transport = $arg;
|
||||
}
|
||||
else if (preg_match('/^(sha|md5)$/i', $arg)) {
|
||||
} elseif (preg_match('/^(sha|md5)$/i', $arg)) {
|
||||
$v3['authalgo'] = $arg;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
echo 'Invalid argument: '.$arg."\n";
|
||||
return;
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
array_push($config['snmp']['v3'], $v3);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
else if ($seclevel === 'ap' or $seclevel === 'authPriv') {
|
||||
} elseif ($seclevel === 'ap' or $seclevel === 'authPriv') {
|
||||
$v3['authlevel'] = 'authPriv';
|
||||
$v3args = array_slice($argv, 4);
|
||||
$v3['authname'] = array_shift($v3args);
|
||||
@@ -137,41 +131,31 @@ if (!empty($argv[1])) {
|
||||
// parse all remaining args
|
||||
if (is_numeric($arg)) {
|
||||
$port = $arg;
|
||||
}
|
||||
else if (preg_match('/^('.implode('|', $config['snmp']['transports']).')$/i', $arg)) {
|
||||
} elseif (preg_match('/^('.implode('|', $config['snmp']['transports']).')$/i', $arg)) {
|
||||
$transport = $arg;
|
||||
}
|
||||
else if (preg_match('/^(sha|md5)$/i', $arg)) {
|
||||
} elseif (preg_match('/^(sha|md5)$/i', $arg)) {
|
||||
$v3['authalgo'] = $arg;
|
||||
}
|
||||
else if (preg_match('/^(aes|des)$/i', $arg)) {
|
||||
} elseif (preg_match('/^(aes|des)$/i', $arg)) {
|
||||
$v3['cryptoalgo'] = $arg;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
echo 'Invalid argument: '.$arg."\n";
|
||||
return;
|
||||
exit(2);
|
||||
}
|
||||
}//end while
|
||||
|
||||
array_push($config['snmp']['v3'], $v3);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
else {
|
||||
// Error or do nothing ?
|
||||
}//end if
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// v2c or v1
|
||||
$v2args = array_slice($argv, 2);
|
||||
|
||||
while ($arg = array_shift($v2args)) {
|
||||
// parse all remaining args
|
||||
if (is_numeric($arg)) {
|
||||
$port = $arg;
|
||||
}
|
||||
else if (preg_match('/('.implode('|', $config['snmp']['transports']).')/i', $arg)) {
|
||||
} elseif (preg_match('/('.implode('|', $config['snmp']['transports']).')/i', $arg)) {
|
||||
$transport = $arg;
|
||||
}
|
||||
else if (preg_match('/^(v1|v2c)$/i', $arg)) {
|
||||
} elseif (preg_match('/^(v1|v2c)$/i', $arg)) {
|
||||
$snmpver = $arg;
|
||||
}
|
||||
}
|
||||
@@ -179,36 +163,20 @@ if (!empty($argv[1])) {
|
||||
if ($community) {
|
||||
$config['snmp']['community'] = array($community);
|
||||
}
|
||||
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}//end if
|
||||
|
||||
if ($snmpver) {
|
||||
$snmpversions[] = $snmpver;
|
||||
$result = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
|
||||
if (is_numeric($result)) {
|
||||
$device = device_by_id_cache($result);
|
||||
echo 'Added device '.$device['hostname'].' ('.$result.")\n";
|
||||
exit(0);
|
||||
}
|
||||
else {
|
||||
$snmpversions = array(
|
||||
'v2c',
|
||||
'v3',
|
||||
'v1',
|
||||
);
|
||||
print $console_color->convert("%rWe couldn't add this device:\n " . $result . "%n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while (!$device_id && count($snmpversions)) {
|
||||
$snmpver = array_shift($snmpversions);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
}
|
||||
|
||||
if ($device_id) {
|
||||
$device = device_by_id_cache($device_id);
|
||||
echo 'Added device '.$device['hostname'].' ('.$device_id.")\n";
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
print $console_color->convert("%rWe couldn't add this device, please check the snmp details%n\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
print $console_color->convert(
|
||||
"\n".$config['project_name_version'].' Add Host Tool
|
||||
@@ -229,4 +197,5 @@ else {
|
||||
%rRemember to run discovery for the host afterwards.%n
|
||||
'
|
||||
);
|
||||
exit(2);
|
||||
}
|
||||
|
@@ -455,12 +455,13 @@ function FormatAlertTpl($obj) {
|
||||
function DescribeAlert($alert) {
|
||||
$obj = array();
|
||||
$i = 0;
|
||||
$device = dbFetchRow('SELECT hostname, sysName, location FROM devices WHERE device_id = ?', array($alert['device_id']));
|
||||
$device = dbFetchRow('SELECT hostname, sysName, location, uptime FROM devices WHERE device_id = ?', array($alert['device_id']));
|
||||
$tpl = dbFetchRow('SELECT `template`,`title`,`title_rec` FROM `alert_templates` JOIN `alert_template_map` ON `alert_template_map`.`alert_templates_id`=`alert_templates`.`id` WHERE `alert_template_map`.`alert_rule_id`=?', array($alert['rule_id']));
|
||||
$default_tpl = "%title\r\nSeverity: %severity\r\n{if %state == 0}Time elapsed: %elapsed\r\n{/if}Timestamp: %timestamp\r\nUnique-ID: %uid\r\nRule: {if %name}%name{else}%rule{/if}\r\n{if %faults}Faults:\r\n{foreach %faults} #%key: %value.string\r\n{/foreach}{/if}Alert sent to: {foreach %contacts}%value <%key> {/foreach}";
|
||||
$obj['hostname'] = $device['hostname'];
|
||||
$obj['sysName'] = $device['sysName'];
|
||||
$obj['location'] = $device['location'];
|
||||
$obj['uptime'] = $device['uptime'];
|
||||
$obj['device_id'] = $alert['device_id'];
|
||||
$extra = $alert['details'];
|
||||
if (!isset($tpl['template'])) {
|
||||
|
@@ -47,6 +47,9 @@ $config['poller-wrapper']['alerter'] = FALSE;
|
||||
# Uncomment the next line to disable daily updates
|
||||
#$config['update'] = 0;
|
||||
|
||||
# Number in days of how long to keep old rrd files. 0 disables this feature
|
||||
$config['rrd_purge'] = 0;
|
||||
|
||||
# Uncomment to submit callback stats via proxy
|
||||
#$config['callback_proxy'] = "hostname:port";
|
||||
|
||||
|
11
daily.php
11
daily.php
@@ -31,6 +31,17 @@ if ($options['f'] === 'update') {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($options['f'] === 'rrd_purge') {
|
||||
if (is_numeric($config['rrd_purge']) && $config['rrd_purge'] > 0) {
|
||||
$cmd = "find ".$config['rrd_dir']." -type f -mtime +".$config['rrd_purge']." -print -exec rm -f {} +";
|
||||
$purge = `$cmd`;
|
||||
if (!empty($purge)) {
|
||||
echo "Purged the following RRD files due to old age (over ".$config['rrd_purge']." days old):\n";
|
||||
echo $purge;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($options['f'] === 'syslog') {
|
||||
if (is_numeric($config['syslog_purge'])) {
|
||||
$rows = dbFetchRow('SELECT MIN(seq) FROM syslog');
|
||||
|
13
daily.sh
13
daily.sh
@@ -38,10 +38,20 @@ if [ -z "$arg" ]; then
|
||||
exit
|
||||
elif [ "$up" -eq 1 ]; then
|
||||
# Update to Master-Branch
|
||||
old_ver=$(git show --pretty="%H" -s HEAD)
|
||||
status_run 'Updating to latest codebase' 'git pull --quiet'
|
||||
new_ver=$(git show --pretty="%H" -s HEAD)
|
||||
if [ "$old_ver" != "$new_ver" ]; then
|
||||
status_run "Updated from $old_ver to $new_ver" ''
|
||||
fi
|
||||
elif [ "$up" -eq 3 ]; then
|
||||
# Update to last Tag
|
||||
old_ver=$(git describe --exact-match --tags $(git log -n1 --pretty='%h'))
|
||||
status_run 'Updating to latest release' 'git fetch --tags && git checkout $(git describe --tags $(git rev-list --tags --max-count=1))'
|
||||
new_ver=$(git describe --exact-match --tags $(git log -n1 --pretty='%h'))
|
||||
if [ "$old_ver" -ne "$new_ver" ]; then
|
||||
status_run "Updated from $old_ver to $new_ver" ''
|
||||
fi
|
||||
fi
|
||||
|
||||
cnf=$(echo $(grep '\[.distributed_poller.\]' config.php | egrep -v -e '^//' -e '^#' | cut -d = -f 2 | sed 's/;//g'))
|
||||
@@ -66,7 +76,7 @@ else
|
||||
status_run 'Fetching notifications' "$0 notifications"
|
||||
;;
|
||||
cleanup)
|
||||
# DB-Cleanups
|
||||
# Cleanups
|
||||
php daily.php -f syslog
|
||||
php daily.php -f eventlog
|
||||
php daily.php -f authlog
|
||||
@@ -76,6 +86,7 @@ else
|
||||
php daily.php -f purgeusers
|
||||
php daily.php -f bill_data
|
||||
php daily.php -f alert_log
|
||||
php daily.php -f rrd_purge
|
||||
;;
|
||||
submodules)
|
||||
# Init+Update our submodules
|
||||
|
@@ -1,135 +0,0 @@
|
||||
Agent setup
|
||||
-----------
|
||||
|
||||
To gather data from remote systems you can use LibreNMS in combination with check_mk (included in the scripts directory).
|
||||
|
||||
Make sure that xinetd is installed on the host you want to run the agent on.
|
||||
|
||||
The agent uses TCP-Port 6556, please allow access from the LibreNMS-Host and Poller-Nodes if you're using the Distributed Polling setup.
|
||||
|
||||
On each of the hosts you would like to use the agent on then you need to do the following:
|
||||
|
||||
* Clone the `librenms-agent` repository:
|
||||
|
||||
```shell
|
||||
cd /opt/
|
||||
git clone https://github.com/librenms/librenms-agent.git
|
||||
cd librenms-agent
|
||||
```
|
||||
|
||||
Now copy the relevant check_mk_agent:
|
||||
|
||||
| linux | freebsd |
|
||||
| --- | --- |
|
||||
| `cp check_mk_agent /usr/bin/check_mk_agent` | `cp check_mk_agent_freebsd /usr/bin/check_mk_agent` |
|
||||
|
||||
```shell
|
||||
chmod +x /usr/bin/check_mk_agent
|
||||
```
|
||||
|
||||
* Copy the service file(s) into place.
|
||||
|
||||
| xinetd | systemd |
|
||||
| --- | --- |
|
||||
| `cp check_mk_xinetd /etc/xinetd.d/check_mk` | `cp check_mk@.service check_mk.socket /etc/systemd/system` |
|
||||
|
||||
* Create the relevant directories.
|
||||
|
||||
```shell
|
||||
mkdir -p /usr/lib/check_mk_agent/plugins /usr/lib/check_mk_agent/local
|
||||
```
|
||||
|
||||
* Copy each of the scripts from `agent-local/` into `/usr/lib/check_mk_agent/local` that you require to be graphed.
|
||||
* Make each one executable that you want to use with `chmod +x /usr/lib/check_mk_agent/local/$script`
|
||||
* Enable service scripts
|
||||
|
||||
| xinetd | systemd |
|
||||
| --- | --- |
|
||||
| `/etc/init.d/xinetd restart` | `systemctl enable --now check_mk.socket` |
|
||||
|
||||
|
||||
* Login to the LibreNMS web interface and edit the device you want to monitor. Under the modules section, ensure that unix-agent is enabled.
|
||||
* Then under Applications, enable the apps that you plan to monitor.
|
||||
* Wait, in around 10 minutes you should start seeing data in your graphs under Apps for the device.
|
||||
|
||||
## Application Specific Configuration
|
||||
|
||||
### BIND9/named
|
||||
|
||||
Create stats file with appropriate permissions:
|
||||
```shell
|
||||
~$ touch /etc/bind/named.stats
|
||||
~$ chown bind:bind /etc/bind/named.stats
|
||||
```
|
||||
Change `user:group` to the user and group that's running bind/named.
|
||||
|
||||
Bind/named configuration:
|
||||
```text
|
||||
options {
|
||||
...
|
||||
statistics-file "/etc/bind/named.stats";
|
||||
zone-statistics yes;
|
||||
...
|
||||
};
|
||||
```
|
||||
Restart your bind9/named after changing the configuration.
|
||||
|
||||
Verify that everything works by executing `rndc stats && cat /etc/bind/named.stats`.
|
||||
In case you get a `Permission Denied` error, make sure you chown'ed correctly.
|
||||
|
||||
Note: if you change the path you will need to change the path in `scripts/agent-local/bind`.
|
||||
|
||||
### TinyDNS/djbdns
|
||||
|
||||
__Installation__:
|
||||
|
||||
1. Get tinystats sources from http://www.morettoni.net/tinystats.en.html
|
||||
2. Compile like as advised.
|
||||
_Note_: In case you get `Makefile:9: *** missing separator. Stop.`, compile manually using:
|
||||
* With IPv6: `gcc -Wall -O2 -fstack-protector -DWITH_IPV6 -o tinystats tinystats.c`
|
||||
* Without IPv6: `gcc -Wall -O2 -fstack-protector -o tinystats tinystats.c`
|
||||
3. Install into preferred path, like `/usr/bin/`.
|
||||
|
||||
__Configuration__:
|
||||
|
||||
_Note_: In this part we assume that you use DJB's [Daemontools](http://cr.yp.to/daemontools.html) to start/stop tinydns.
|
||||
And that your tinydns-instance is located in `/service/dns`, adjust this path if necessary.
|
||||
|
||||
1. Replace your _log_'s `run` file, typically located in `/service/dns/log/run` with:
|
||||
```
|
||||
#!/bin/sh
|
||||
|
||||
exec setuidgid dnslog tinystats ./main/tinystats/ multilog t n3 s250000 ./main/
|
||||
```
|
||||
2. Create tinystats directory and chown:
|
||||
`mkdir /service/dns/log/main/tinystats && chown dnslog:nofiles /service/dns/log/main/tinystats`
|
||||
3. Restart TinyDNS and Daemontools: `/etc/init.d/svscan restart`
|
||||
_Note_: Some say `svc -t /service/dns` is enough, on my install (Gentoo) it doesn't rehook the logging and I'm forced to restart it entirely.
|
||||
|
||||
### MySQL
|
||||
|
||||
Unlike most other scripts, the MySQL script requires a configuration file `/usr/lib/check_mk_agent/local/mysql.cnf` with following content:
|
||||
|
||||
```php
|
||||
<?php
|
||||
$mysql_user = 'root';
|
||||
$mysql_pass = 'toor';
|
||||
$mysql_host = 'localhost';
|
||||
$mysql_port = 3306;
|
||||
```
|
||||
|
||||
NOTE: This only applies to the PHP-Version of the Statistics-poller. There's work being done in porting this script to Python, a different configuration file (if any) will apply.
|
||||
|
||||
### Nginx
|
||||
|
||||
It's required to have the following directive in your nginx-configuration responsible for the localhost-server:
|
||||
|
||||
```text
|
||||
location /nginx-status {
|
||||
stub_status on;
|
||||
access_log off;
|
||||
allow 127.0.0.1;
|
||||
deny all;
|
||||
}
|
||||
```
|
||||
|
@@ -192,6 +192,11 @@ $config['alert']['admins'] = true; //Include Administrators into alert-contacts
|
||||
|
||||
> You can configure these options within the WebUI now, please avoid setting these options within config.php
|
||||
|
||||
For all but the default contact, we support setting multiple email addresses separated by a comma. So you can
|
||||
set the devices sysContact, override the sysContact or have your users emails set like:
|
||||
|
||||
`email@domain.com, alerting@domain.com`
|
||||
|
||||
E-Mail transport is enabled with adding the following to your `config.php`:
|
||||
~
|
||||
```php
|
||||
@@ -268,7 +273,7 @@ $config['alert']['transports']['irc'] = true;
|
||||
|
||||
> You can configure these options within the WebUI now, please avoid setting these options within config.php
|
||||
|
||||
The Slack transport will POST the alert message to your Slack Incoming WebHook, you are able to specify multiple webhooks along with the relevant options to go with it. All options are optional, the only required value is for url, without this then no call to Slack will be made. Below is an example of how to send alerts to two channels with different customised options:
|
||||
The Slack transport will POST the alert message to your Slack Incoming WebHook using the [attachments](https://api.slack.com/docs/message-attachments) option, you are able to specify multiple webhooks along with the relevant options to go with it. Simple html tags are stripped from the message. All options are optional, the only required value is for url, without this then no call to Slack will be made. Below is an example of how to send alerts to two channels with different customised options:
|
||||
|
||||
~~
|
||||
```php
|
||||
|
222
doc/Extensions/Applications.md
Normal file
222
doc/Extensions/Applications.md
Normal file
@@ -0,0 +1,222 @@
|
||||
Applications
|
||||
------------
|
||||
You can use Application support to graph performance statistics from many applications.
|
||||
|
||||
Different applications support a variety of ways collect data: by direct connection to the application, snmpd extend, or the agent.
|
||||
|
||||
1. [BIND9/named](#bind9-aka-named) - Agent
|
||||
2. [MySQL](#mysql) - Agent
|
||||
3. [NGINX](#nginx) - Agent
|
||||
4. [PowerDNS](#powerdns) - Agent
|
||||
5. [PowerDNS Recursor](#powerdns-recursor) - Agent
|
||||
6. [TinyDNS/djbdns](#tinydns-aka-djbdns) - Agent
|
||||
7. [OS Updates](#os-updates) - extend SNMP
|
||||
8. [DHCP Stats](#dhcp-stats) - extend SNMP
|
||||
9. [Memcached](#memcached) - extend SNMP
|
||||
|
||||
|
||||
* [Agent Setup](#agent-setup)
|
||||
|
||||
### BIND9 aka named
|
||||
|
||||
##### Agent
|
||||
[Install the agent](#agent-setup) on this device if it isn't already and copy the `bind` script to `/usr/lib/check_mk_agent/local/`
|
||||
|
||||
Create stats file with appropriate permissions:
|
||||
```shell
|
||||
~$ touch /etc/bind/named.stats
|
||||
~$ chown bind:bind /etc/bind/named.stats
|
||||
```
|
||||
Change `user:group` to the user and group that's running bind/named.
|
||||
|
||||
Bind/named configuration:
|
||||
```text
|
||||
options {
|
||||
...
|
||||
statistics-file "/etc/bind/named.stats";
|
||||
zone-statistics yes;
|
||||
...
|
||||
};
|
||||
```
|
||||
Restart your bind9/named after changing the configuration.
|
||||
|
||||
Verify that everything works by executing `rndc stats && cat /etc/bind/named.stats`.
|
||||
In case you get a `Permission Denied` error, make sure you chown'ed correctly.
|
||||
|
||||
Note: if you change the path you will need to change the path in `scripts/agent-local/bind`.
|
||||
|
||||
|
||||
### MySQL
|
||||
|
||||
##### Agent
|
||||
[Install the agent](#agent-setup) on this device if it isn't already and copy the `mysql` script to `/usr/lib/check_mk_agent/local/`
|
||||
|
||||
The MySQL script requires PHP-CLI and the PHP MySQL extension, so please verify those are installed.
|
||||
|
||||
Unlike most other scripts, the MySQL script requires a configuration file `/usr/lib/check_mk_agent/local/mysql.cnf` with following content:
|
||||
|
||||
```php
|
||||
<?php
|
||||
$mysql_user = 'root';
|
||||
$mysql_pass = 'toor';
|
||||
$mysql_host = 'localhost';
|
||||
$mysql_port = 3306;
|
||||
```
|
||||
|
||||
Verify it is working by running `/usr/lib/check_mk_agent/local/mysql`
|
||||
|
||||
### NGINX
|
||||
|
||||
NGINX is a free, open-source, high-performance HTTP server: https://www.nginx.org/
|
||||
|
||||
##### Agent
|
||||
[Install the agent](#agent-setup) on this device if it isn't already and copy the `nginx` script to `/usr/lib/check_mk_agent/local/`
|
||||
|
||||
It's required to have the following directive in your nginx configuration responsible for the localhost server:
|
||||
|
||||
```text
|
||||
location /nginx-status {
|
||||
stub_status on;
|
||||
access_log off;
|
||||
allow 127.0.0.1;
|
||||
deny all;
|
||||
}
|
||||
```
|
||||
|
||||
### PowerDNS
|
||||
An authoritative DNS server: https://www.powerdns.com/auth.html
|
||||
|
||||
##### Agent
|
||||
[Install the agent](#agent-setup) on this device if it isn't already and copy the `powerdns` script to `/usr/lib/check_mk_agent/local/`
|
||||
|
||||
|
||||
### PowerDNS Recursor
|
||||
A recursive DNS server: https://www.powerdns.com/recursor.html
|
||||
|
||||
##### Direct
|
||||
The LibreNMS polling host must be able to connect to port 8082 on the monitored device.
|
||||
The web-server must be enabled, see the Recursor docs: https://doc.powerdns.com/md/recursor/settings/#webserver
|
||||
|
||||
###### Variables
|
||||
`$config['apps']['powerdns-recursor']['api-key']` required, this is defined in the Recursor config
|
||||
`$config['apps']['powerdns-recursor']['port']` numeric, defines the port to connect to PowerDNS Recursor on. The default is 8082
|
||||
`$config['apps']['powerdns-recursor']['https']` true or false, defaults to use http.
|
||||
|
||||
##### Agent
|
||||
[Install the agent](#agent-setup) on this device if it isn't already and copy the `powerdns-recursor` script to `/usr/lib/check_mk_agent/local/`
|
||||
|
||||
This script uses `rec_control get-all` to collect stats.
|
||||
|
||||
|
||||
### TinyDNS aka djbdns
|
||||
|
||||
##### Agent
|
||||
[Install the agent](#agent-setup) on this device if it isn't already and copy the `tinydns` script to `/usr/lib/check_mk_agent/local/`
|
||||
|
||||
_Note_: We assume that you use DJB's [Daemontools](http://cr.yp.to/daemontools.html) to start/stop tinydns.
|
||||
And that your tinydns instance is located in `/service/dns`, adjust this path if necessary.
|
||||
|
||||
1. Replace your _log_'s `run` file, typically located in `/service/dns/log/run` with:
|
||||
```shell
|
||||
#!/bin/sh
|
||||
exec setuidgid dnslog tinystats ./main/tinystats/ multilog t n3 s250000 ./main/
|
||||
```
|
||||
2. Create tinystats directory and chown:
|
||||
```shell
|
||||
mkdir /service/dns/log/main/tinystats
|
||||
chown dnslog:nofiles /service/dns/log/main/tinystats
|
||||
```
|
||||
3. Restart TinyDNS and Daemontools: `/etc/init.d/svscan restart`
|
||||
_Note_: Some say `svc -t /service/dns` is enough, on my install (Gentoo) it doesn't rehook the logging and I'm forced to restart it entirely.
|
||||
|
||||
### OS Updates
|
||||
A small shell script that checks your system package manager for any available updates (supports yum/apt-get/zypper package managers).
|
||||
|
||||
##### Extend SNMP
|
||||
1. Copy the shell script to the desired host (the host must be added to LibreNMS devices)
|
||||
2. Make the script executable (chmod +x /opt/os-updates.sh)
|
||||
3. Edit your snmpd.conf file (usually /etc/snmp/snmpd.conf) and add:
|
||||
```
|
||||
extend osupdate /opt/os-updates.sh
|
||||
```
|
||||
4. Restart snmpd on your host
|
||||
5. On the device page in Librenms, edit your host and check the `OS Updates` under the Applications tab.
|
||||
|
||||
_Note_: apt-get depends on an updated package index. There are several ways to have your system run `apt-get update` automatically. The easiest is to create `/etc/apt/apt.conf.d/10periodic` and pasting the following in it: `APT::Periodic::Update-Package-Lists "1";`.
|
||||
If you have apticron, cron-apt or apt-listchanges installed and configured, chances are that packages are already updated periodically.
|
||||
|
||||
### DHCP Stats
|
||||
A small shell script that reports current DHCP leases stats.
|
||||
|
||||
##### Extend SNMP
|
||||
1. Copy the shell script to the desired host (the host must be added to LibreNMS devices)
|
||||
2. Make the script executable (chmod +x /opt/dhcp-status.sh)
|
||||
3. Edit your snmpd.conf file (usually /etc/snmp/snmpd.conf) and add:
|
||||
```
|
||||
extend dhcpstats /opt/dhcp-status.sh
|
||||
```
|
||||
4. Restart snmpd on your host
|
||||
5. On the device page in Librenms, edit your host and check the `DHCP Stats` under the Applications tab.
|
||||
|
||||
### Memcached
|
||||
1. Copy the [memcached script](https://github.com/librenms/librenms-agent/blob/master/agent-local/memcached) to `/usr/local/bin` (or any other suitable location) on your remote server.
|
||||
2. Make the script executable: `chmod +x /usr/local/memcached`
|
||||
3. Edit your snmpd.conf file (usually `/etc/snmp/snmpd.conf`) and add:
|
||||
```
|
||||
extend memcached /usr/local/bin/memcached
|
||||
```
|
||||
4. Restart snmpd on your host
|
||||
5. On the device page in Librenms, edit your host and check `Memcached` under the Applications tab.
|
||||
|
||||
Agent Setup
|
||||
-----------
|
||||
|
||||
To gather data from remote systems you can use LibreNMS in combination with check_mk (found [here](https://github.com/librenms/librenms-agent)).
|
||||
|
||||
Make sure that systemd or xinetd is installed on the host you want to run the agent on.
|
||||
|
||||
The agent uses TCP-Port 6556, please allow access from the **LibreNMS host** and **poller nodes** if you're using the [Distributed Polling](http://docs.librenms.org/Extensions/Distributed-Poller/) setup.
|
||||
|
||||
On each of the hosts you would like to use the agent on then you need to do the following:
|
||||
|
||||
1. Clone the `librenms-agent` repository:
|
||||
|
||||
```shell
|
||||
cd /opt/
|
||||
git clone https://github.com/librenms/librenms-agent.git
|
||||
cd librenms-agent
|
||||
```
|
||||
|
||||
2. Copy the relevant check_mk_agent to `/usr/bin`:
|
||||
|
||||
| linux | freebsd |
|
||||
| --- | --- |
|
||||
| `cp check_mk_agent /usr/bin/check_mk_agent` | `cp check_mk_agent_freebsd /usr/bin/check_mk_agent` |
|
||||
|
||||
```shell
|
||||
chmod +x /usr/bin/check_mk_agent
|
||||
```
|
||||
|
||||
3. Copy the service file(s) into place.
|
||||
|
||||
| xinetd | systemd |
|
||||
| --- | --- |
|
||||
| `cp check_mk_xinetd /etc/xinetd.d/check_mk` | `cp check_mk@.service check_mk.socket /etc/systemd/system` |
|
||||
|
||||
4. Create the relevant directories.
|
||||
|
||||
```shell
|
||||
mkdir -p /usr/lib/check_mk_agent/plugins /usr/lib/check_mk_agent/local
|
||||
```
|
||||
|
||||
5. Copy each of the scripts from `agent-local/` into `/usr/lib/check_mk_agent/local` that you require to be graphed. You can find detail setup instructions for specific applications above.
|
||||
6. Make each one executable that you want to use with `chmod +x /usr/lib/check_mk_agent/local/$script`
|
||||
7. Enable the check_mk service
|
||||
|
||||
| xinetd | systemd |
|
||||
| --- | --- |
|
||||
| `/etc/init.d/xinetd restart` | `systemctl enable check_mk.socket && systemctl start check_mk.socket` |
|
||||
|
||||
8. Login to the LibreNMS web interface and edit the device you want to monitor. Under the modules section, ensure that unix-agent is enabled.
|
||||
9. Then under Applications, enable the apps that you plan to monitor.
|
||||
10. Wait for around 10 minutes and you should start seeing data in your graphs under Apps for the device.
|
@@ -1,10 +1,57 @@
|
||||
# Auto discovery support
|
||||
|
||||
### Getting started with auto discovery.
|
||||
|
||||
LibreNMS provides the ability to automatically add devices on your network, we can do this with via
|
||||
a few methods which will be explained below and also indicate if they are enabled by default.
|
||||
|
||||
All discovery methods run when discovery.php runs (every 6 hours by default and within 5 minutes for new devices).
|
||||
|
||||
> Please note that you need at least ONE device added before auto-discovery will work.
|
||||
|
||||
The first thing to do though is add the required configuration options to `config.php`.
|
||||
|
||||
#### SNMP Details
|
||||
|
||||
To add devices automatically we need to know your snmp details, examples of SNMP v1, v2c and v3 are below:
|
||||
|
||||
```php
|
||||
// v1 or v2c
|
||||
$config['snmp']['community'][] = "my_custom_community";
|
||||
$config['snmp']['community'][] = "another_community";
|
||||
|
||||
// v3
|
||||
$config['snmp']['v3'][0]['authlevel'] = 'AuthPriv';
|
||||
$config['snmp']['v3'][0]['authname'] = 'my_username';
|
||||
$config['snmp']['v3'][0]['authpass'] = 'my_password';
|
||||
$config['snmp']['v3'][0]['authalgo'] = 'MD5';
|
||||
$config['snmp']['v3'][0]['cryptopass'] = 'my_crypto';
|
||||
$config['snmp']['v3'][0]['cryptoalgo'] = 'AES';
|
||||
```
|
||||
|
||||
These details will be attempted when adding devices, you can specify any mixture of these.
|
||||
|
||||
#### Your networks
|
||||
|
||||
To add devices, we need to know what are your subnets so we don't go blindly attempting to add devices not
|
||||
under your control.
|
||||
|
||||
```php
|
||||
$config['nets'][] = '192.168.0.0/24';
|
||||
$config['nets'][] = '172.2.4.0/22';
|
||||
```
|
||||
|
||||
#### Exclusions
|
||||
|
||||
If you have added a network as above but a single device exists within it that you can't auto
|
||||
add, then you can exclude this with the following:
|
||||
|
||||
```php
|
||||
$config['autodiscovery']['nets-exclude'][] = '192.168.0.1/32';
|
||||
```
|
||||
|
||||
If you want to enable / disable certain auto-discovery modules then see the rest of this doc for further info.
|
||||
|
||||
### Discovery methods
|
||||
|
||||
#### ARP
|
||||
@@ -31,23 +78,16 @@ Enabled by default.
|
||||
|
||||
This module is invoked from bgp-peers discovery module.
|
||||
|
||||
### Including / Excluding subnets to scan
|
||||
#### SNMP Scan
|
||||
This isn't actually an auto- mechanism but manually invoked.
|
||||
|
||||
By default the following config is in place to exclude loopback, multicast, etc ranges. You can expand this out by adding more
|
||||
ranges to config.php
|
||||
It's designed to scan through all of the subnets in your config or what you have manually specified
|
||||
to automatically add devices. An example of it's usage is:
|
||||
|
||||
```php
|
||||
$config['autodiscovery']['nets-exclude'][] = '0.0.0.0/8';
|
||||
$config['autodiscovery']['nets-exclude'][] = '127.0.0.0/8';
|
||||
$config['autodiscovery']['nets-exclude'][] = '169.254.0.0/16';
|
||||
$config['autodiscovery']['nets-exclude'][] = '224.0.0.0/4';
|
||||
$config['autodiscovery']['nets-exclude'][] = '240.0.0.0/4';
|
||||
```bash
|
||||
./snmp-scan.php r 192.168.0.0/24
|
||||
```
|
||||
|
||||
You will need to specify your own subnets that you would like to scan for which can be done with:
|
||||
|
||||
`$config['nets'][] = '8.8.8.0/24';`
|
||||
|
||||
#### Discovering devices by IP
|
||||
|
||||
By default we don't add devices by IP address, we look for a reverse dns name to be found and add with that. If this fails
|
||||
|
@@ -23,7 +23,7 @@ Table of Content:
|
||||
The Component extension provides a generic database storage mechanism for discovery and poller modules.
|
||||
The Driver behind this extension was to provide the features of ports, in a generic manner to discovery/poller modules.
|
||||
|
||||
It provides a status (Normal or Alert), the ability to Disable (do not poll), or Ignore (do not Alert).
|
||||
It provides a status (Nagios convention), the ability to Disable (do not poll), or Ignore (do not Alert).
|
||||
|
||||
# <a name="database">Database Structure</a>
|
||||
|
||||
@@ -282,18 +282,23 @@ Please see the [API-Docs](http://docs.librenms.org/API/API-Docs/#api-route-25) f
|
||||
## <a name="alert">Alerting</a>
|
||||
|
||||
It is intended that discovery/poller modules will detect the status of a component during the polling cycle.
|
||||
If you are creating a poller module which can detect a fault condition simply set STATUS to 0 and ERROR to a message that indicates the problem.
|
||||
Status is logged using the Nagios convention for status codes, where:
|
||||
0 = Ok,
|
||||
1 = Warning,
|
||||
2 = Critical
|
||||
|
||||
If you are creating a poller module which can detect a fault condition simply set STATUS to something other than 0 and ERROR to a message that indicates the problem.
|
||||
|
||||
To actually raise an alert, the user will need to create an alert rule. To assist with this several Alerting Macro's have been created:
|
||||
|
||||
- ```%macro.component_alert``` - A component that is not disabled or ignored and in alert state.
|
||||
- ```%macro.component_normal``` - A component that is not disabled or ignored and NOT in alert state.
|
||||
- ```%macro.component_normal``` - A component that is not disabled or ignored and in a Normal state.
|
||||
- ```%macro.component_warning``` - A component that is not disabled or ignored and NOT in a Warning state.
|
||||
- ```%macro.component_critical``` - A component that is not disabled or ignored and NOT in a Critical state.
|
||||
|
||||
To raise alerts for components, the following rules could be created:
|
||||
|
||||
- ```%macros.component_alert = "1"``` - To alert on all components
|
||||
- ```%macros.component_alert = "1" && %component.type = "<Type of Component>"``` - To alert on all components of a particular type.
|
||||
- ```%macros.component_critical = "1"``` - To alert on all Critical components
|
||||
- ```%macros.component_critical = "1" && %component.type = "<Type of Component>"``` - To alert on all Critical components of a particular type.
|
||||
|
||||
If there is a particular component you would like excluded from alerting, simply set the ignore field to 1.
|
||||
|
||||
|
@@ -12,7 +12,7 @@ In config.php, enable Proxmox:
|
||||
$config['enable_proxmox'] = 1;
|
||||
```
|
||||
|
||||
Then, install [librenms-agent](http://docs.librenms.org/Extensions/Agent-Setup/) on the machines running Proxmox and enable the Proxmox-script using:
|
||||
Then, install [librenms-agent](http://docs.librenms.org/Extensions/Applications/) on the machines running Proxmox and enable the Proxmox-script using:
|
||||
|
||||
```bash
|
||||
cp /opt/librenms-agent/proxmox /usr/lib/check_mk_agent/local/proxmox
|
||||
|
@@ -112,6 +112,16 @@ $template librenms,"%fromhost%||%syslogfacility%||%syslogpriority%||%syslogsever
|
||||
|
||||
Ancient versions of rsyslog may require different syntax.
|
||||
|
||||
This is an example for rsyslog 5 (default on Debian 7):
|
||||
```bash
|
||||
# Feed syslog messages to librenms
|
||||
$ModLoad omprog
|
||||
$template librenms,"%FROMHOST%||%syslogfacility-text%||%syslogpriority-text%||%syslogseverity%||%syslogtag%||%$YEAR%-%$MONTH%-%$DAY% %timegenerated:8:25%||%msg%||%programname%\n"
|
||||
|
||||
$ActionOMProgBinary /opt/librenms/syslog.php
|
||||
*.* :omprog:;librenms
|
||||
```
|
||||
|
||||
If your rsyslog server is recieving messages relayed by another syslog server, you may try replacing `%fromhost%` with `%hostname%`, since `fromhost` is the host the message was received from, not the host that generated the message. The `fromhost` property is preferred as it avoids problems caused by devices sending incorrect hostnames in syslog messages.
|
||||
|
||||
Add the following to your LibreNMS `config.php` file to enable the Syslog extension:
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -32,17 +32,17 @@ Any issues with these images should be reported via [Github](https://github.com/
|
||||
|
||||
#### Download
|
||||
|
||||
[OVA Image](http://www.lathwood.co.uk/librenms/librenms_centos_7.ova) - 968M
|
||||
[OVA Image](http://www.lathwood.co.uk/librenms/librenms_centos_7.ova) - 1.1G
|
||||
|
||||
- md5sum: 619ef0071ee25c95cf2939a388b9021b
|
||||
- md5sum: 53f0c06c26255e859144e471ae85eedc
|
||||
|
||||
- sha256sum: 39c1e129badd407b7c8c51bfa2e240ae6424947b95964872cd871f00bccaf141
|
||||
- sha256sum: 9d902e8452ec8f88ab96180b46113ab5c8ef9213b16cebbbf3f88df37670ebd4
|
||||
|
||||
[VMDK Image](http://www.lathwood.co.uk/librenms/librenms_centos_7.vmdk) - 2.5G
|
||||
[VMDK Image](http://www.lathwood.co.uk/librenms/librenms_centos_7.vmdk) - 2.8G
|
||||
|
||||
- md5sum: fccbd2fdc645f706ca9da2fdfe0f11f1
|
||||
- md5sum: 8c54cb929ba9e16bc9a985a292b8f9d9
|
||||
|
||||
- sha256sum: 1038b4c475cd67dfbcdce3f13b482949c15cf0862a73ab50e00e4d6b253f3897
|
||||
- sha256sum: 944d1164f0664334fdb50e425049819a18da5568c56b6b49681a9ebe13ae9489
|
||||
|
||||
#### Credentials
|
||||
|
||||
|
@@ -21,7 +21,7 @@ FLUSH PRIVILEGES;
|
||||
exit
|
||||
```
|
||||
|
||||
`vim /etc/my.cnf`
|
||||
`vim /etc/my.cnf.d/server.cnf`
|
||||
|
||||
Within the [mysqld] section please add:
|
||||
|
||||
@@ -153,6 +153,15 @@ That's it! You now should be able to log in to http://librenms.example.com/. P
|
||||
|
||||
We now suggest that you add localhost as your first device from within the WebUI.
|
||||
|
||||
#### What next?
|
||||
|
||||
Now that you've installed LibreNMS, we'd suggest that you have a read of a few other docs to get you going:
|
||||
|
||||
- (Performance tuning)[http://docs.librenms.org/Support/Performance]
|
||||
- (Alerting)[http://docs.librenms.org/Extensions/Alerting/]
|
||||
- (Device Groups)[http://docs.librenms.org/Extensions/Device-Groups/]
|
||||
- (Auto discovery)[http://docs.librenms.org/Extensions/Auto-Discovery/]
|
||||
|
||||
#### Closing
|
||||
|
||||
We hope you enjoy using LibreNMS. If you do, it would be great if you would consider opting into the stats system we have, please see [this page](http://docs.librenms.org/General/Callback-Stats-and-Privacy/) on what it is and how to enable it.
|
||||
|
@@ -50,15 +50,14 @@ pear install Net_IPv6-1.2.2b2
|
||||
In `/etc/php.ini` ensure date.timezone is set to your preferred time zone. See http://php.net/manual/en/timezones.php for a list of supported timezones. Valid examples are: "America/New York", "Australia/Brisbane", "Etc/UTC".
|
||||
|
||||
```bash
|
||||
service php7.0-fpm restart
|
||||
phpenmod mcrypt
|
||||
service php-fpm restart
|
||||
```
|
||||
|
||||
#### Add librenms user
|
||||
|
||||
```bash
|
||||
useradd librenms -d /opt/librenms -M -r
|
||||
usermod -a -G librenms apache
|
||||
usermod -a -G librenms nginx
|
||||
```
|
||||
|
||||
#### Clone repo
|
||||
@@ -165,6 +164,15 @@ That's it! You now should be able to log in to http://librenms.example.com/. P
|
||||
|
||||
We now suggest that you add localhost as your first device from within the WebUI.
|
||||
|
||||
#### What next?
|
||||
|
||||
Now that you've installed LibreNMS, we'd suggest that you have a read of a few other docs to get you going:
|
||||
|
||||
- (Performance tuning)[http://docs.librenms.org/Support/Performance]
|
||||
- (Alerting)[http://docs.librenms.org/Extensions/Alerting/]
|
||||
- (Device Groups)[http://docs.librenms.org/Extensions/Device-Groups/]
|
||||
- (Auto discovery)[http://docs.librenms.org/Extensions/Auto-Discovery/]
|
||||
|
||||
#### Closing
|
||||
|
||||
We hope you enjoy using LibreNMS. If you do, it would be great if you would consider opting into the stats system we have, please see [this page](http://docs.librenms.org/General/Callback-Stats-and-Privacy/) on what it is and how to enable it.
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#### Install / Configure MySQL
|
||||
```bash
|
||||
apt-get install mariadb-server mariadb-client
|
||||
service mariadb restart
|
||||
service mysql restart
|
||||
mysql -uroot -p
|
||||
```
|
||||
|
||||
@@ -30,7 +30,7 @@ innodb_file_per_table=1
|
||||
sql-mode=""
|
||||
```
|
||||
|
||||
```service mariadb restart```
|
||||
```service mysql restart```
|
||||
|
||||
### Web Server ###
|
||||
|
||||
@@ -135,6 +135,15 @@ That's it! You now should be able to log in to http://librenms.example.com/. P
|
||||
|
||||
We now suggest that you add localhost as your first device from within the WebUI.
|
||||
|
||||
#### What next?
|
||||
|
||||
Now that you've installed LibreNMS, we'd suggest that you have a read of a few other docs to get you going:
|
||||
|
||||
- (Performance tuning)[http://docs.librenms.org/Support/Performance]
|
||||
- (Alerting)[http://docs.librenms.org/Extensions/Alerting/]
|
||||
- (Device Groups)[http://docs.librenms.org/Extensions/Device-Groups/]
|
||||
- (Auto discovery)[http://docs.librenms.org/Extensions/Auto-Discovery/]
|
||||
|
||||
#### Closing
|
||||
|
||||
We hope you enjoy using LibreNMS. If you do, it would be great if you would consider opting into the stats system we have, please see [this page](http://docs.librenms.org/General/Callback-Stats-and-Privacy/) on what it is and how to enable it.
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#### Install / Configure MySQL
|
||||
```bash
|
||||
apt-get install mariadb-server mariadb-client
|
||||
service mariadb restart
|
||||
service mysql restart
|
||||
mysql -uroot -p
|
||||
```
|
||||
|
||||
@@ -30,7 +30,7 @@ innodb_file_per_table=1
|
||||
sql-mode=""
|
||||
```
|
||||
|
||||
```service mariadb restart```
|
||||
```service mysql restart```
|
||||
|
||||
### Web Server ###
|
||||
|
||||
@@ -138,6 +138,15 @@ That's it! You now should be able to log in to http://librenms.example.com/. P
|
||||
|
||||
We now suggest that you add localhost as your first device from within the WebUI.
|
||||
|
||||
#### What next?
|
||||
|
||||
Now that you've installed LibreNMS, we'd suggest that you have a read of a few other docs to get you going:
|
||||
|
||||
- (Performance tuning)[http://docs.librenms.org/Support/Performance]
|
||||
- (Alerting)[http://docs.librenms.org/Extensions/Alerting/]
|
||||
- (Device Groups)[http://docs.librenms.org/Extensions/Device-Groups/]
|
||||
- (Auto discovery)[http://docs.librenms.org/Extensions/Auto-Discovery/]
|
||||
|
||||
#### Closing
|
||||
|
||||
We hope you enjoy using LibreNMS. If you do, it would be great if you would consider opting into the stats system we have, please see [this page](http://docs.librenms.org/General/Callback-Stats-and-Privacy/) on what it is and how to enable it.
|
||||
|
@@ -33,17 +33,17 @@ Any issues with these images should be reported via [Github](https://github.com/
|
||||
|
||||
#### Download
|
||||
|
||||
[OVA Image](http://www.lathwood.co.uk/librenms/librenms_ubuntu_1604.ova) - 1.3G
|
||||
[OVA Image](http://www.lathwood.co.uk/librenms/librenms_ubuntu_1604.ova) - 1.6G
|
||||
|
||||
- md5sum: 944fcd73e918eabec7509569c2d98cf0
|
||||
- md5sum: 18c13c521aa5a6f5e96be2641324a626
|
||||
|
||||
- sha256sum: 2a792e1d39813f0bdd510445aa04bc88e226311e825dddeb3780cf5d58bef43c
|
||||
- sha256sum: 78c09dcd441633ea633118fbc51090e032257752b1f0698fcd084b2b025b6343
|
||||
|
||||
[VMDK Image](http://www.lathwood.co.uk/librenms/librenms_ubuntu_1604.vmdk) - 3.3G
|
||||
[VMDK Image](http://www.lathwood.co.uk/librenms/librenms_ubuntu_1604.vmdk) - 4.0G
|
||||
|
||||
- md5sum: e84e31e437e946a9a01d0c87059bfe04
|
||||
- md5sum: fc072de8ee6c95ccee1a7a4cd8d08f4c
|
||||
|
||||
- sha256sum: 4f687608291161ffd8f5e1aee38be1d6b9e0c2a13d15252da62fe783578f5708
|
||||
- sha256sum: 36a2252a6f6f7a3a8d7b5e2fda00eb7949a8d9d1fb637a440773aac5ebf838f3
|
||||
|
||||
#### Credentials
|
||||
|
||||
|
@@ -496,10 +496,14 @@ $config['eventlog_purge'] = 30;
|
||||
$config['authlog_purge'] = 30;
|
||||
$config['perf_times_purge'] = 30;
|
||||
$config['device_perf_purge'] = 30;
|
||||
$config['rrd_purge'] = 90;// Not set by default
|
||||
```
|
||||
This option will ensure data within LibreNMS over 1 month old is automatically purged. You can alter these individually,
|
||||
These options will ensure data within LibreNMS over X days old is automatically purged. You can alter these individually,
|
||||
values are in days.
|
||||
|
||||
> NOTE: Please be aware that `$config['rrd_purge']` is _NOT_ set by default. This option will remove any old data within
|
||||
the rrd directory automatically - only enable this if you are comfortable with that happening.
|
||||
|
||||
#### Syslog options
|
||||
|
||||
```php
|
||||
|
@@ -20,6 +20,7 @@
|
||||
|
||||
### Developing
|
||||
- [How do I add support for a new OS?](#faq8)
|
||||
- [What information do you need to add a new OS?](#faq20)
|
||||
- [What can I do to help?](#faq9)
|
||||
- [How can I test another users branch?](#faq13)
|
||||
|
||||
@@ -75,6 +76,9 @@ If the page you are trying to load has a substantial amount of data in it then i
|
||||
|
||||
The easiest way to check if all is well is to run `./validate.php` as root from within your install directory. This should give you info on why things aren't working.
|
||||
|
||||
One other reason could be a restricted snmpd.conf file or snmp view which limits the data sent back. If you use net-snmp then we suggest using
|
||||
the (included snmpd.conf)[https://raw.githubusercontent.com/librenms/librenms/master/snmpd.conf.example] file.
|
||||
|
||||
#### <a name="faq7"> How do I debug pages not loading correctly?</a>
|
||||
|
||||
A debug system is in place which enables you to see the output from php errors, warnings and notices along with the MySQL queries that have been run for that page.
|
||||
@@ -153,6 +157,20 @@ This file will usually set the variables for $version and $hardware gained from
|
||||
**html/images/os/$os.png**
|
||||
This is a 32x32 png format image of the OS you are adding support for.
|
||||
|
||||
#### <a name="faq20"> What information do you need to add a new OS?</a>
|
||||
|
||||
Please provide the following output as seperate non-expiring pastebin.com links.
|
||||
|
||||
Replace the relevant information in these commands such as HOSTNAME and COMMUNITY.
|
||||
|
||||
```bash
|
||||
./discovery.php -h HOSTNAME -d -m os
|
||||
./poller.php -h HOSTNAME -r -f -d -m os
|
||||
snmpbulkwalk -On -v2c -c COMMUNITY HOSTNAME .
|
||||
```
|
||||
|
||||
If possible please also provide what the OS name should be if it doesn't exist already.
|
||||
|
||||
#### <a name="faq9"> What can I do to help?</a>
|
||||
|
||||
Thanks for asking, sometimes it's not quite so obvious and everyone can contribute something different. So here are some ways you can help LibreNMS improve.
|
||||
|
@@ -21,6 +21,8 @@ Here's a brief list of supported vendors, some might be missing.
|
||||
If you are unsure of whether your device is supported or not, feel free to ask us.
|
||||
|
||||
* 3Com
|
||||
* ADTRAN
|
||||
* Acceidan
|
||||
* Aerohive
|
||||
* AKCP
|
||||
* Alcatel-Lucent
|
||||
@@ -32,13 +34,21 @@ If you are unsure of whether your device is supported or not, feel free to ask u
|
||||
* Aruba
|
||||
* Avaya
|
||||
* Avocent
|
||||
* AVTECH
|
||||
* Axis
|
||||
* Barracuda
|
||||
* BCM963
|
||||
* BDCom
|
||||
* Bintec
|
||||
* BNT
|
||||
* Brocade
|
||||
* Brother
|
||||
* Buffalo
|
||||
* Calix
|
||||
* Cambium
|
||||
* Canon
|
||||
* Canopy
|
||||
* Check Point
|
||||
* Cisco
|
||||
* Cisco Small Business
|
||||
* Citrix
|
||||
@@ -46,34 +56,45 @@ If you are unsure of whether your device is supported or not, feel free to ask u
|
||||
* Comware
|
||||
* D-Link
|
||||
* Datacom
|
||||
* Deliberant
|
||||
* Dell
|
||||
* Delta Power Solutions
|
||||
* DEVELOP
|
||||
* Eaton
|
||||
* EMC
|
||||
* Engenius
|
||||
* Enterasys
|
||||
* Epson
|
||||
* Extreme Networks
|
||||
* F5
|
||||
* Fastback Networks
|
||||
* FiberHome
|
||||
* Force10
|
||||
* Fortigate
|
||||
* Fortinet
|
||||
* FreeBSD
|
||||
* Gamatronic
|
||||
* Hikvision
|
||||
* HP
|
||||
* Huawei
|
||||
* HW group
|
||||
* IBM
|
||||
* Infoblox
|
||||
* iPoMan
|
||||
* ITWatchDogs
|
||||
* Juniper
|
||||
* Konica Minolta
|
||||
* Kyocera
|
||||
* Lantronix
|
||||
* Lenovo
|
||||
* Lexmark
|
||||
* Liebert
|
||||
* LigoWave
|
||||
* Linux
|
||||
* Maipu
|
||||
* Mellanox
|
||||
* Meraki
|
||||
* MGE
|
||||
* Microsemi
|
||||
* Mikrotik
|
||||
* MRVLD
|
||||
* Multimatic
|
||||
@@ -88,12 +109,14 @@ If you are unsure of whether your device is supported or not, feel free to ask u
|
||||
* NRG
|
||||
* OKI
|
||||
* OpenBSD
|
||||
* Oracle
|
||||
* PacketShaper
|
||||
* Palo Alto Networks
|
||||
* Papouch
|
||||
* PBN
|
||||
* Perle
|
||||
* Powercode
|
||||
* Powerwalker
|
||||
* Prestige
|
||||
* Proxim
|
||||
* Proxmox
|
||||
@@ -104,7 +127,8 @@ If you are unsure of whether your device is supported or not, feel free to ask u
|
||||
* Ricoh
|
||||
* Riverbed
|
||||
* Ruckus
|
||||
* SAF
|
||||
* SAF Tehnika
|
||||
* Samsung
|
||||
* Siklu
|
||||
* Sentry3
|
||||
* Solaris
|
||||
@@ -112,10 +136,12 @@ If you are unsure of whether your device is supported or not, feel free to ask u
|
||||
* SpeedTouch
|
||||
* Supermicro
|
||||
* Symbol
|
||||
* Telco Systems
|
||||
* TPLink
|
||||
* Tranzeo
|
||||
* Triplite
|
||||
* Tripp Lite
|
||||
* Ubiquiti
|
||||
* Viprinet
|
||||
* VMware
|
||||
* VRP
|
||||
* Vyatta
|
||||
@@ -124,5 +150,6 @@ If you are unsure of whether your device is supported or not, feel free to ask u
|
||||
* WebPower
|
||||
* Windows
|
||||
* Xerox
|
||||
* Xirrus
|
||||
* ZTE
|
||||
* ZyXEL
|
||||
|
61
doc/Support/Performance.md
Normal file
61
doc/Support/Performance.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Performance optimisations
|
||||
|
||||
This document will give you some guidance on optimising your setup.
|
||||
|
||||
The suggestions are in a rough order of how much impact they will have.
|
||||
|
||||
#### RRDCached
|
||||
|
||||
We absolutely recommend running this, it will save on IO load. [RRDCached](http://docs.librenms.org/Extensions/RRDCached/)
|
||||
|
||||
|
||||
#### MySQL Optimisation
|
||||
|
||||
It's advisable after 24 hours of running MySQL that you run (MySQL Tuner)[https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl]
|
||||
which will make suggestions on things you can change specific to your setup.
|
||||
|
||||
One recommendation we can make is that you set the following in my.cnf:
|
||||
|
||||
```bash
|
||||
innodb_flush_log_at_trx_commit = 0
|
||||
```
|
||||
|
||||
You can also set this to 2. This will have the possibility that you could lose up to 1 second on mysql data in the event
|
||||
MySQL crashes or your server does but it provides an amazing difference in IO use.
|
||||
|
||||
|
||||
#### Polling modules
|
||||
|
||||
Disable polling (and discovery) modules that you do not need. You can do this globally in `config.php` like:
|
||||
|
||||
Disable OSPF polling
|
||||
```php
|
||||
$config['poller_modules']['ospf'] = 0;
|
||||
```
|
||||
|
||||
You can disable modules globally then re-enable the module per device or the opposite way. For a list of modules please see
|
||||
[Poller modules](http://docs.librenms.org/Support/Poller%20Support/)
|
||||
|
||||
#### SNMP Max Repeaters
|
||||
|
||||
We have support for SNMP Max repeaters which can be handy on devices where we poll a lot of ports or bgp sessions for instance and
|
||||
where snmpwalk or snmpbulkwalk is used. This needs to be enabled on a per device basis under edit device -> snmp -> Max repeaters.
|
||||
|
||||
It's advisable to test the time taken to snmpwalk IF-MIB or something similar to work out what the best value is. To do this run the following
|
||||
but replace <REPEATERS> with varying numbers from 10 upto around 50. You will also need to set the correct snmp version, hostname and community string:
|
||||
|
||||
`time snmpbulkwalk -v2c -cpublic HOSTNAME -Cr<REPEATERS> -M /opt/librenms/mibs -m IF-MIB`
|
||||
|
||||
> NOTE: Do not go blindly setting this value as you can impact polling negatively.
|
||||
|
||||
#### Optimise poller-wrapper
|
||||
|
||||
The default 16 threads that `poller-wrapper.py` runs as isn't necessarily the optimal number. A general rule of thumb is
|
||||
2 threads per core but we suggest that you play around with lowering / increasing the number until you get the optimal value.
|
||||
|
||||
#### Recursive DNS
|
||||
|
||||
If your install uses hostnames for devices and you have quite a lot then it's advisable to setup a local recursive dns instance on the
|
||||
LibreNMS server. Something like pdns-recursor can be used and then configure `/etc/resolv.conf` to use 127.0.0.1 for queries.
|
||||
|
||||
|
@@ -43,8 +43,8 @@ ul ul ul { list-style: square outside; }
|
||||
}
|
||||
|
||||
.pagemenu-selected {
|
||||
font-weight: bold;
|
||||
background-color: #dfdfdf;
|
||||
font-weight: bold;
|
||||
background-color: #dfdfdf;
|
||||
|
||||
border: 1px solid #c0c0c0;
|
||||
|
||||
@@ -436,7 +436,7 @@ tr.list-device-ignored-up {
|
||||
}
|
||||
|
||||
.device-head, a.list-device {
|
||||
color: #1111aa;
|
||||
color: #23527c;
|
||||
}
|
||||
|
||||
a.list-device-down, a.list-device-down, a.list-device-down:visited {
|
||||
@@ -1251,7 +1251,7 @@ a.interface-upup:hover, a.interface-updown:hover, a.interface-admindown:hover {
|
||||
padding:1px;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Header
|
||||
-----------------------------------------------------------------------------*/
|
||||
@@ -1332,15 +1332,15 @@ a.interface-upup:hover, a.interface-updown:hover, a.interface-admindown:hover {
|
||||
}
|
||||
|
||||
.div-normal {
|
||||
|
||||
|
||||
}
|
||||
.div-alert {
|
||||
border: 2px solid;
|
||||
border: 2px solid;
|
||||
#border-radius: 10px;
|
||||
border-color: #cc0000;
|
||||
}
|
||||
.div-ignore {
|
||||
|
||||
|
||||
}
|
||||
.div-ignore-alert {
|
||||
|
||||
@@ -1749,7 +1749,7 @@ tr.search:nth-child(odd) {
|
||||
-o-user-select: none;
|
||||
user-select: none; // Default
|
||||
}
|
||||
|
||||
|
||||
.zoomOut {
|
||||
top:30px;
|
||||
}
|
||||
|
BIN
html/images/os/checkpoint.png
Normal file
BIN
html/images/os/checkpoint.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
html/images/os/maipu.png
Normal file
BIN
html/images/os/maipu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
html/images/os/opensuse.png
Normal file
BIN
html/images/os/opensuse.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -290,13 +290,13 @@ function add_device() {
|
||||
}
|
||||
if (empty($message)) {
|
||||
$result = addHost($hostname, $snmpver, $port, $transport, 1, $poller_group, $force_add);
|
||||
if ($result) {
|
||||
if (is_numeric($result)) {
|
||||
$code = 201;
|
||||
$status = 'ok';
|
||||
$message = "Device $hostname has been added successfully";
|
||||
}
|
||||
else {
|
||||
$message = "Failed adding $hostname";
|
||||
$message = $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
41
html/includes/common/component-status.inc.php
Normal file
41
html/includes/common/component-status.inc.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
require_once "../includes/component.php";
|
||||
$OBJCOMP = new component();
|
||||
|
||||
$common_output[] = '
|
||||
<div>
|
||||
<table id="component-status" class="table table-hover table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="status" data-order="desc">Status</th>
|
||||
<th data-column-id="count">Count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
';
|
||||
foreach ($OBJCOMP->getComponentStatus() as $k => $v) {
|
||||
if ($k == 0) {
|
||||
$status = 'Ok';
|
||||
$color = 'green';
|
||||
}
|
||||
elseif ($k == 1) {
|
||||
$status = 'Warning';
|
||||
$color = 'grey';
|
||||
}
|
||||
else {
|
||||
$status = 'Critical';
|
||||
$color = 'red';
|
||||
}
|
||||
$common_output[] .= '
|
||||
<tr>
|
||||
<td><p class="text-left '.$color.'">'.$status.'</p></td>
|
||||
<td><p class="text-left '.$color.'">'.$v.'</p></td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
$common_output[] .= '
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
';
|
@@ -5,6 +5,7 @@ $common_output[] = '
|
||||
<table id="syslog" class="table table-hover table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="priority"> </th>
|
||||
<th data-column-id="timestamp" data-order="desc">Datetime</th>
|
||||
<th data-column-id="device_id">Hostname</th>
|
||||
<th data-column-id="program">Program</th>
|
||||
@@ -21,7 +22,11 @@ var syslog_grid = $("#syslog").bootgrid({
|
||||
{
|
||||
return {
|
||||
id: "syslog",
|
||||
device: "' .mres($vars['device']) .'",
|
||||
device: "'.mres($vars['device']) .'",
|
||||
program: "'.mres($vars['program']).'",
|
||||
priority: "'.mres($vars['priority']).'",
|
||||
to: "'.mres($vars['to']).'",
|
||||
from: "'.mres($vars['from']).'",
|
||||
};
|
||||
},
|
||||
url: "ajax_table.php"
|
||||
|
@@ -50,28 +50,38 @@ function data_uri($file, $mime) {
|
||||
}//end data_uri()
|
||||
|
||||
|
||||
function nicecase($item) {
|
||||
function nicecase($item)
|
||||
{
|
||||
switch ($item) {
|
||||
case 'dbm':
|
||||
return 'dBm';
|
||||
case 'dbm':
|
||||
return 'dBm';
|
||||
|
||||
case 'mysql':
|
||||
return ' MySQL';
|
||||
case 'mysql':
|
||||
return ' MySQL';
|
||||
|
||||
case 'powerdns':
|
||||
return 'PowerDNS';
|
||||
case 'powerdns':
|
||||
return 'PowerDNS';
|
||||
|
||||
case 'bind':
|
||||
return 'BIND';
|
||||
case 'bind':
|
||||
return 'BIND';
|
||||
|
||||
case 'nfs-stats':
|
||||
return 'NFS Stats';
|
||||
case 'nfs-stats':
|
||||
return 'NFS Stats';
|
||||
|
||||
case 'nfs-v3-stats':
|
||||
return 'NFS v3 Stats';
|
||||
case 'nfs-v3-stats':
|
||||
return 'NFS v3 Stats';
|
||||
|
||||
default:
|
||||
return ucfirst($item);
|
||||
case 'os-updates':
|
||||
return 'OS Updates';
|
||||
|
||||
case 'powerdns-recursor':
|
||||
return 'PowerDNS Recursor';
|
||||
|
||||
case 'dhcp-stats':
|
||||
return 'DHCP Stats';
|
||||
|
||||
default:
|
||||
return ucfirst($item);
|
||||
}
|
||||
|
||||
}//end nicecase()
|
||||
|
44
html/includes/graphs/application/dhcp-stats.inc.php
Normal file
44
html/includes/graphs/application/dhcp-stats.inc.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
require 'includes/graphs/common.inc.php';
|
||||
$name = 'dhcp-stats';
|
||||
$app_id = $app['app_id'];
|
||||
$scale_min = 0;
|
||||
$colours = 'mixed';
|
||||
$unit_text = 'Leases';
|
||||
$unitlen = 10;
|
||||
$bigdescrlen = 15;
|
||||
$smalldescrlen = 15;
|
||||
$dostack = 0;
|
||||
$printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 15;
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', $name, $app_id));
|
||||
|
||||
$array = array(
|
||||
'dhcp_total' => array('descr' => 'Total','colour' => '582A72',),
|
||||
'dhcp_active' => array('descr' => 'Active','colour' => '28774F',),
|
||||
'dhcp_expired' => array('descr' => 'Expired','colour' => 'AA6C39',),
|
||||
'dhcp_released' => array('descr' => 'Released','colour' => '88CC88',),
|
||||
'dhcp_abandoned' => array('descr' => 'Abandoned','colour' => 'D46A6A',),
|
||||
'dhcp_reset' => array('descr' => 'Reset','colour' => 'FFD1AA',),
|
||||
'dhcp_bootp' => array('descr' => 'BootP','colour' => '582A72',),
|
||||
'dhcp_backup' => array('descr' => 'Backup','colour' => 'AA5439',),
|
||||
'dhcp_free' => array('descr' => 'Free','colour' => '28536C',),
|
||||
);
|
||||
|
||||
$i = 0;
|
||||
if (is_file($rrd_filename)) {
|
||||
foreach ($array as $ds => $vars) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $vars['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $vars['colour'];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_v3_multiline.inc.php';
|
@@ -34,4 +34,4 @@ else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
require 'includes/graphs/generic_v3_multiline.inc.php';
|
@@ -31,4 +31,4 @@ else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
require 'includes/graphs/generic_v3_multiline.inc.php';
|
@@ -33,4 +33,4 @@ else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
require 'includes/graphs/generic_v3_multiline.inc.php';
|
@@ -41,4 +41,4 @@ else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
require 'includes/graphs/generic_v3_multiline.inc.php';
|
@@ -32,4 +32,4 @@ else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
require 'includes/graphs/generic_v3_multiline.inc.php';
|
@@ -34,4 +34,4 @@ else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
require 'includes/graphs/generic_v3_multiline.inc.php';
|
@@ -51,4 +51,4 @@ else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
require 'includes/graphs/generic_v3_multiline.inc.php';
|
36
html/includes/graphs/application/os-updates.inc.php
Normal file
36
html/includes/graphs/application/os-updates.inc.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
require 'includes/graphs/common.inc.php';
|
||||
$name = 'os-updates';
|
||||
$app_id = $app['app_id'];
|
||||
$scale_min = 0;
|
||||
$colours = 'mixed';
|
||||
$unit_text = 'Available updates';
|
||||
$unitlen = 18;
|
||||
$bigdescrlen = 18;
|
||||
$smalldescrlen = 18;
|
||||
$dostack = 0;
|
||||
$printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 33;
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', $name, $app_id));
|
||||
|
||||
$array = array(
|
||||
'packages' => array('descr' => 'packages','colour' => '2B9220',),
|
||||
);
|
||||
|
||||
$i = 0;
|
||||
if (is_file($rrd_filename)) {
|
||||
foreach ($array as $ds => $vars) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $vars['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $vars['colour'];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_v3_multiline.inc.php';
|
30
html/includes/graphs/application/powerdns-recursor.inc.php
Normal file
30
html/includes/graphs/application/powerdns-recursor.inc.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* powerdns-recursor.inc.php
|
||||
*
|
||||
* -Description-
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Tony Murray
|
||||
* @author Tony Murray <murraytony@gmail.com>
|
||||
*/
|
||||
|
||||
$rrd = rrd_name($device['hostname'], array('app', 'powerdns-recursor', $app['app_id']));
|
||||
if (is_file($rrd)) {
|
||||
$rrd_filename = $rrd;
|
||||
}
|
||||
$simple_rrd = true;
|
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* powerdns-recursor_answers.inc.php
|
||||
*
|
||||
* Graph of answers
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Tony Murray
|
||||
* @author Tony Murray <murraytony@gmail.com>
|
||||
*/
|
||||
|
||||
include 'powerdns-recursor.inc.php';
|
||||
|
||||
$colours = 'oranges';
|
||||
$unit_text = 'Answers/sec';
|
||||
$print_total = true;
|
||||
|
||||
if (is_file($rrd_filename)) {
|
||||
$rrd_list = array(
|
||||
array(
|
||||
'ds' => 'answers0-1',
|
||||
'filename' => $rrd_filename,
|
||||
'descr' => '0-1ms',
|
||||
),
|
||||
array(
|
||||
'ds' => 'answers1-10',
|
||||
'filename' => $rrd_filename,
|
||||
'descr' => '1-10ms',
|
||||
),
|
||||
array(
|
||||
'ds' => 'answers10-100',
|
||||
'filename' => $rrd_filename,
|
||||
'descr' => '10-100ms',
|
||||
),
|
||||
array(
|
||||
'ds' => 'answers100-1000',
|
||||
'filename' => $rrd_filename,
|
||||
'descr' => '100-1000ms',
|
||||
),
|
||||
array(
|
||||
'ds' => 'answers-slow',
|
||||
'filename' => $rrd_filename,
|
||||
'descr' => '>1s',
|
||||
),
|
||||
);
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi.inc.php';
|
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* powerdns-recursor_cache_performance.inc.php
|
||||
*
|
||||
* -Description-
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Tony Murray
|
||||
* @author Tony Murray <murraytony@gmail.com>
|
||||
*/
|
||||
include 'powerdns-recursor.inc.php';
|
||||
|
||||
$colours = 'mixed';
|
||||
$unit_text = 'Packets/sec';
|
||||
|
||||
if (is_file($rrd_filename)) {
|
||||
$rrd_list = array(
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'cache-hits',
|
||||
'descr' => 'Query Cache Hits',
|
||||
'colour' => '297159',
|
||||
'area' => true,
|
||||
),
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'cache-misses',
|
||||
'descr' => 'Query Cache Misses',
|
||||
'colour' => '73AC61',
|
||||
'area' => true,
|
||||
),
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'packetcache-hits',
|
||||
'descr' => 'Packet Cache Hits',
|
||||
'colour' => 'BC7049',
|
||||
'area' => true,
|
||||
),
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'packetcache-misses',
|
||||
'descr' => 'Packet Cache Misses',
|
||||
'colour' => 'C98F45',
|
||||
'area' => true,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi_line.inc.php';
|
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* powerdns-recursor_cache_size.inc.php
|
||||
*
|
||||
* -Description-
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Tony Murray
|
||||
* @author Tony Murray <murraytony@gmail.com>
|
||||
*/
|
||||
|
||||
include 'powerdns-recursor.inc.php';
|
||||
|
||||
$colours = 'purples';
|
||||
$unit_text = 'Entries';
|
||||
|
||||
if (is_file($rrd_filename)) {
|
||||
$rrd_list = array(
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'cache-entries',
|
||||
'descr' => 'Query Cache',
|
||||
'colour' => '202048',
|
||||
),
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'packetcache-entries',
|
||||
'descr' => 'Packet Cache',
|
||||
'colour' => 'CC7CCC',
|
||||
)
|
||||
);
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi_line.inc.php';
|
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* powerdns-recursor_outqueries.inc.php
|
||||
*
|
||||
* -Description-
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Tony Murray
|
||||
* @author Tony Murray <murraytony@gmail.com>
|
||||
*/
|
||||
|
||||
include 'powerdns-recursor.inc.php';
|
||||
|
||||
$colours = 'mixed';
|
||||
$unit_text = 'Queries/sec';
|
||||
|
||||
if (is_file($rrd_filename)) {
|
||||
$rrd_list = array(
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'all-outqueries',
|
||||
'descr' => 'Total',
|
||||
'area' => true,
|
||||
),
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'ipv6-outqueries',
|
||||
'descr' => 'IPv6',
|
||||
'area' => true,
|
||||
),
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'tcp-outqueries',
|
||||
'descr' => 'TCP',
|
||||
'area' => true,
|
||||
),
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'throttled-out',
|
||||
'descr' => 'Throttled',
|
||||
'area' => true,
|
||||
),
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'outgoing-timeouts',
|
||||
'descr' => 'Timeouts',
|
||||
'area' => true,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi_line.inc.php';
|
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* powerdns-recursor_questions.inc.php
|
||||
*
|
||||
* -Description-
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Tony Murray
|
||||
* @author Tony Murray <murraytony@gmail.com>
|
||||
*/
|
||||
|
||||
include 'powerdns-recursor.inc.php';
|
||||
|
||||
$colours = 'mixed';
|
||||
$unit_text = 'Questions/sec';
|
||||
|
||||
if (is_file($rrd_filename)) {
|
||||
$rrd_list = array(
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'questions',
|
||||
'descr' => 'Total Questions',
|
||||
'area' => true,
|
||||
),
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'ipv6-questions',
|
||||
'descr' => 'IPv6 Questions',
|
||||
'area' => true,
|
||||
),
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'tcp-questions',
|
||||
'descr' => 'TCP Questions',
|
||||
'area' => true,
|
||||
),
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'over-capacity-drops',
|
||||
'descr' => 'Over Capacity Drops',
|
||||
'area' => true,
|
||||
),
|
||||
array(
|
||||
'filename' => $rrd_filename,
|
||||
'ds' => 'policy-drops',
|
||||
'descr' => 'Policy Drops',
|
||||
'area' => true,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi_line.inc.php';
|
@@ -47,8 +47,7 @@ foreach ($stats as $stat => $color) {
|
||||
}
|
||||
|
||||
// Set up Total value
|
||||
$rrd_options .= " 'CDEF:cdeftotal=cdefrequest,cdefack,cdefdiscover,cdefoffer,
|
||||
cdefinform,cdefnack,cdefrelease,cdefdecline,cdefother,+,+,+,+,+,+,+,+'";
|
||||
$rrd_options .= " 'CDEF:cdeftotal=cdefrequest,cdefack,cdefdiscover,cdefoffer,cdefinform,cdefnack,cdefrelease,cdefdecline,cdefother,+,+,+,+,+,+,+,+'";
|
||||
$rrd_options .= " 'LINE1:cdeftotal#000000FF:Total'";
|
||||
$filler = 8 - strlen("Total");
|
||||
$current_pad = str_pad("", $filler, ' ', STR_PAD_LEFT);
|
||||
|
@@ -7,7 +7,7 @@ if (!is_array($config['nfsen_rrds'])) {
|
||||
}
|
||||
|
||||
foreach ($config['nfsen_rrds'] as $nfsenrrds) {
|
||||
if ($configs[(strlen($nfsenrrds) - 1)] != '/') {
|
||||
if ($nfsenrrds[(strlen($nfsenrrds) - 1)] != '/') {
|
||||
$nfsenrrds .= '/';
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ foreach ($config['nfsen_rrds'] as $nfsenrrds) {
|
||||
}
|
||||
|
||||
$basefilename_underscored = preg_replace('/\./', $config['nfsen_split_char'], $device['hostname']);
|
||||
$nfsen_filename = (strstr($basefilename_underscored, $nfsensuffix, true));
|
||||
$nfsen_filename = preg_replace('/'.$nfsensuffix.'/', '', $basefilename_underscored);
|
||||
|
||||
if (is_file($nfsenrrds.$nfsen_filename.'.rrd')) {
|
||||
$rrd_filename = $nfsenrrds.$nfsen_filename.'.rrd';
|
||||
|
@@ -1,5 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Outputs a stacked, filled line graph
|
||||
*
|
||||
* Variables:
|
||||
* $rrd_list array required - array of data sets to graph. Each item is an array that contains the following
|
||||
* ds string required - data set name as defined in rrd
|
||||
* filename string required - path to the rrd file as generated by rrd_name()
|
||||
* descr string required - the label for this data set
|
||||
* colour string optional - Defines the colour for this data set (overrides the overall colour set)
|
||||
* invert boolean optional - multiplies values in this data set by -1
|
||||
* $colours string required - colour set as defined in $config['graph_colours']
|
||||
* $print_total boolean optional - Sum all the values and output the last, min, max, and avg in the legend
|
||||
* $simplerrd boolean optional - All data sets reside in the same rrd file
|
||||
*/
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
if ($width > '500') {
|
||||
@@ -29,20 +44,26 @@ else {
|
||||
|
||||
$i = 0;
|
||||
$iter = 0;
|
||||
$ids = array();
|
||||
|
||||
foreach ($rrd_list as $rrd) {
|
||||
if (!$config['graph_colours'][$colours][$iter]) {
|
||||
$iter = 0;
|
||||
// get the color for this data set
|
||||
if(isset($rrd['colour'])) {
|
||||
$colour = $rrd['colour'];
|
||||
} else {
|
||||
if (!$config['graph_colours'][$colours][$iter]) {
|
||||
$iter = 0;
|
||||
}
|
||||
$colour = $config['graph_colours'][$colours][$iter];
|
||||
$iter++;
|
||||
}
|
||||
|
||||
$colour = $config['graph_colours'][$colours][$iter];
|
||||
|
||||
$ds = $rrd['ds'];
|
||||
$filename = $rrd['filename'];
|
||||
|
||||
$descr = rrdtool_escape($rrd['descr'], $descr_len);
|
||||
|
||||
$id = 'ds'.$i;
|
||||
$ids[] = ($id = 'ds'.$i);
|
||||
|
||||
$rrd_options .= ' DEF:'.$id."=$filename:$ds:AVERAGE";
|
||||
|
||||
@@ -69,10 +90,26 @@ foreach ($rrd_list as $rrd) {
|
||||
$bstack = ':STACK';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$i++;
|
||||
$iter++;
|
||||
}//end foreach
|
||||
|
||||
if ($print_total) {
|
||||
$tot = $ids;
|
||||
for ($i=1; $i<count($ids); $i++) {
|
||||
$tot[] = '+';
|
||||
}
|
||||
|
||||
$rrd_options .= ' CDEF:tot=' . implode($tot, ',');
|
||||
$rrd_options .= ' COMMENT:" '.rrdtool_escape('Total', $descr_len).'"';
|
||||
$rrd_options .= ' GPRINT:tot:LAST:%5.1lf%s';
|
||||
$rrd_options .= ' GPRINT:tot:MIN:%5.1lf%s';
|
||||
$rrd_options .= ' GPRINT:tot:MAX:%5.1lf%s';
|
||||
$rrd_options .= ' GPRINT:tot:AVERAGE:%5.1lf%s\n';
|
||||
}
|
||||
|
||||
$rrd_options .= $rrd_optionsb;
|
||||
$rrd_options .= ' HRULE:0#555555';
|
||||
$rrd_options .= $rrd_optionsc;
|
||||
|
@@ -1,5 +1,22 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Outputs a graph with multiple overlaid lines
|
||||
*
|
||||
* Variables:
|
||||
* $rrd_list array required - array of data sets to graph. Each item is an array that contains the following
|
||||
* ds string required - data set name as defined in rrd
|
||||
* filename string required - path to the rrd file as generated by rrd_name()
|
||||
* descr string required - the label for this data set
|
||||
* colour string optional - Defines the colour for this data set (overrides the overall colour set)
|
||||
* area boolean optional - Colors in the area of the data set with 20% opacity (unless areacolor is set)
|
||||
* areacolor string optional - Sets the area color manually
|
||||
* invert boolean optional - multiplies values in this data set by -1
|
||||
* $colours string required - colour set as defined in $config['graph_colours']
|
||||
* $print_total boolean optional - Sum all the values and output the last, min, max, and avg in the legend
|
||||
* $simplerrd boolean optional - All data sets reside in the same rrd file
|
||||
*/
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
if ($width > '500') {
|
||||
@@ -31,11 +48,17 @@ $i = 0;
|
||||
$iter = 0;
|
||||
|
||||
foreach ($rrd_list as $rrd) {
|
||||
if (!$config['graph_colours'][$colours][$iter]) {
|
||||
$iter = 0;
|
||||
// get the color for this data set
|
||||
if(isset($rrd['colour'])) {
|
||||
$colour = $rrd['colour'];
|
||||
} else {
|
||||
if (!$config['graph_colours'][$colours][$iter]) {
|
||||
$iter = 0;
|
||||
}
|
||||
$colour = $config['graph_colours'][$colours][$iter];
|
||||
$iter++;
|
||||
}
|
||||
|
||||
$colour = $config['graph_colours'][$colours][$iter];
|
||||
if (!empty($rrd['area']) && empty($rrd['areacolour'])) {
|
||||
$rrd['areacolour'] = $colour."20";
|
||||
}
|
||||
@@ -76,7 +99,6 @@ foreach ($rrd_list as $rrd) {
|
||||
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.2lf%s'.$units.' GPRINT:'.$id.":AVERAGE:'%5.2lf%s$units\\n'";
|
||||
|
||||
$i++;
|
||||
$iter++;
|
||||
}//end foreach
|
||||
|
||||
$rrd_options .= $rrd_optionsb;
|
||||
|
@@ -34,17 +34,30 @@ $COMPONENTS = $OBJCOMP->getComponents($device_id,$options);
|
||||
$response[] = array(
|
||||
'id' => '<button type="submit" id="save-form" class="btn btn-success btn-sm" title="Save current component disable/ignore settings">Save</button><button type="submit" id="form-reset" class="btn btn-danger btn-sm" title="Reset form to when the page was loaded">Reset</button>',
|
||||
'label' => ' ',
|
||||
'status' => '<button type="submit" id="alert-select" class="btn btn-default btn-sm" title="Disable alerting on all currently-alerting components">Alerting</button>',
|
||||
'status' => '<button type="submit" id="warning-select" class="btn btn-default btn-sm" title="Disable alerting on all currently warning components">Warning</button> <button type="submit" id="critical-select" class="btn btn-default btn-sm" title="Disable alerting on all currently critical components">Critical</button>',
|
||||
'disable' => '<button type="submit" id="disable-toggle" class="btn btn-default btn-sm" title="Toggle polling for all components">Toggle</button><button type="button" id="disable-select" class="btn btn-default btn-sm" title="Disable polling on all components">Select All</button>',
|
||||
'ignore' => '<button type="submit" id="ignore-toggle" class="btn btn-default btn-sm" title="Toggle alerting for all components">Toggle</button><button type="button" id="ignore-select" class="btn btn-default btn-sm" title="Disable alerting on all components">Select All</button>',
|
||||
);
|
||||
|
||||
foreach ($COMPONENTS[$device_id] as $ID => $AVP) {
|
||||
if ($AVP['status'] == 0) {
|
||||
$class = "green";
|
||||
$status = "Ok";
|
||||
}
|
||||
elseif ($AVP['status'] == 1) {
|
||||
$class = "grey";
|
||||
$status = "Warning";
|
||||
}
|
||||
else {
|
||||
// Critical
|
||||
$class = "red";
|
||||
$status = "Critical";
|
||||
}
|
||||
$response[] = array(
|
||||
'id' => $ID,
|
||||
'type' => $AVP['type'],
|
||||
'label' => $AVP['label'],
|
||||
'status' => ($AVP['status'] ? "<span name='status_".$ID."' class='green'>Normal</span>" : "<span name='status_".$ID."' class='red'>Alert</span>"),
|
||||
'status' => "<span name='status_".$ID."' class='".$class."'>".$status."</span>",
|
||||
'disable' => '<input type="checkbox" class="disable-check" name="dis_'.$ID.'"'.($AVP['disabled'] ? 'checked' : '').'>',
|
||||
'ignore' => '<input type="checkbox" class="ignore-check" name="ign_'.$ID.'"'.($AVP['ignore'] ? 'checked' : '').'>',
|
||||
);
|
||||
|
@@ -17,6 +17,11 @@ if (is_numeric($_POST['device'])) {
|
||||
$param[] = $_POST['device'];
|
||||
}
|
||||
|
||||
if ($_POST['priority']) {
|
||||
$where .= ' AND S.priority = ?';
|
||||
$param[] = $_POST['priority'];
|
||||
}
|
||||
|
||||
if (!empty($_POST['from'])) {
|
||||
$where .= ' AND timestamp >= ?';
|
||||
$param[] = $_POST['from'];
|
||||
@@ -64,7 +69,8 @@ $sql = "SELECT S.*, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['co
|
||||
foreach (dbFetchRows($sql, $param) as $syslog) {
|
||||
$dev = device_by_id_cache($syslog['device_id']);
|
||||
$response[] = array(
|
||||
'timestamp' => $syslog['date'],
|
||||
'priority' => generate_priority_icon($syslog['priority']),
|
||||
'timestamp' => '<div style="white-space:nowrap;">'.$syslog['date'].'</div>',
|
||||
'device_id' => generate_device_link($dev, shorthost($dev['hostname'])),
|
||||
'program' => $syslog['program'],
|
||||
'msg' => htmlspecialchars($syslog['msg']),
|
||||
|
@@ -132,7 +132,7 @@ $complete = 1;
|
||||
<div class="col-md-3">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h4 class="text-center">Stage <?php echo $stage; ?> of <?php echo $total_stages; ?> complete</h2>
|
||||
<h4 class="text-center">Stage <?php echo $stage; ?> of <?php echo $total_stages; ?> complete</h4>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
</div>
|
||||
@@ -538,6 +538,11 @@ elseif($stage == "4") {
|
||||
}
|
||||
elseif($stage == "6") {
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-offset-3 col-md-6">
|
||||
<div class="alert alert-danger">You haven't quite finished yet - please go back to the install docs and carry on the necessary steps to finish the setup!</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
</div>
|
||||
|
@@ -10,7 +10,7 @@ $git_log = `git log -10`;
|
||||
<h4 class="modal-title" id="myModalLabel">Local git log</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<pre><?php echo $git_log; ?></pre>
|
||||
<pre><?php echo htmlspecialchars($git_log, ENT_COMPAT,'ISO-8859-1', true); ?></pre>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
@@ -235,7 +235,6 @@ echo "
|
||||
});
|
||||
});
|
||||
|
||||
// convert the version date from ISO 8601 to the browser's timezone
|
||||
var ver_date = $('#version_date');
|
||||
ver_date.text(new Date(ver_date.text()).toString());
|
||||
ver_date.text(moment.unix(ver_date.text()));
|
||||
</script>
|
||||
|
@@ -67,8 +67,10 @@ if ($_POST['hostname']) {
|
||||
|
||||
$port_assoc_mode = $_POST['port_assoc_mode'];
|
||||
$result = addHost($hostname, $snmpver, $port, $transport, 0, $poller_group, $force_add, $port_assoc_mode);
|
||||
if ($result) {
|
||||
if (is_numeric($result)) {
|
||||
print_message("Device added ($result)");
|
||||
} else {
|
||||
print_error('Error: ' . $result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@@ -33,6 +33,13 @@ $graphs['nginx'] = array(
|
||||
'req',
|
||||
);
|
||||
|
||||
$graphs['powerdns-recursor'] = array(
|
||||
'questions',
|
||||
'answers',
|
||||
'cache_performance',
|
||||
'outqueries'
|
||||
);
|
||||
|
||||
$graphs['rrdcached'] = array(
|
||||
'queue_length',
|
||||
'events',
|
||||
@@ -49,6 +56,29 @@ $graphs['tinydns'] = array(
|
||||
'other',
|
||||
);
|
||||
|
||||
$graphs['powerdns'] = array(
|
||||
'latency',
|
||||
'fail',
|
||||
'packetcache',
|
||||
'querycache',
|
||||
'recursing',
|
||||
'queries',
|
||||
'queries_udp',
|
||||
);
|
||||
|
||||
$graphs['nfs-v3-stats'] = array(
|
||||
'stats',
|
||||
'io',
|
||||
'fh',
|
||||
'rc',
|
||||
'ra',
|
||||
'net',
|
||||
'rpc',
|
||||
);
|
||||
|
||||
$graphs['os-updates'] = array('');
|
||||
$graphs['dhcp-stats'] = array('');
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
echo "<span style='font-weight: bold;'>Apps</span> » ";
|
||||
|
@@ -9,33 +9,35 @@ $graph_array_zoom['height'] = '150';
|
||||
$graph_array_zoom['width'] = '400';
|
||||
$graph_array['legend'] = 'no';
|
||||
|
||||
echo '<h2>'.nicecase($vars['app']).'</h2>';
|
||||
echo '<table cellpadding=5 cellspacing=0 class=devicetable width=100%>';
|
||||
$app_devices = dbFetchRows('SELECT * FROM `devices` AS D, `applications` AS A WHERE D.device_id = A.device_id AND A.app_type = ?', array($vars['app']));
|
||||
|
||||
foreach ($app_devices as $app_device) {
|
||||
echo '<tr class="list-device">';
|
||||
echo '<td class="device-head" width=300px>'.generate_device_link($app_device, shorthost($app_device['hostname']), array('tab' => 'apps', 'app' => $vars['app'])).'</td>';
|
||||
echo '<td class="device-head" width=100px>'.$app_device['app_instance'].'</td>';
|
||||
echo '<td class="device-head" width=100px>'.$app_device['app_status'].'</td>';
|
||||
echo '<td></td>';
|
||||
echo '</tr>';
|
||||
echo '<tr class="list-device">';
|
||||
echo '<td colspan=4>';
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
'.generate_device_link($app_device, shorthost($app_device['hostname']), array('tab' => 'apps', 'app' => $vars['app'])).'
|
||||
<div class="pull-right"><small class="muted">'.$app_device['app_instance'].' '.$app_device['app_status'].'</small></div>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">';
|
||||
|
||||
foreach ($graphs[$vars['app']] as $graph_type) {
|
||||
$graph_array['type'] = 'application_'.$vars['app'].'_'.$graph_type;
|
||||
$graph_array['type'] = empty($graph_type) ? 'application_'.$vars['app'] : 'application_'.$vars['app'].'_'.$graph_type;
|
||||
$graph_array['id'] = $app_device['app_id'];
|
||||
$graph_array_zoom['type'] = 'application_'.$vars['app'].'_'.$graph_type;
|
||||
$graph_array_zoom['id'] = $app_device['app_id'];
|
||||
|
||||
$link = generate_url(array('page' => 'device', 'device' => $app_device['device_id'], 'tab' => 'apps', 'app' => $vars['app']));
|
||||
|
||||
echo '<div class="pull-left">';
|
||||
echo overlib_link($link, generate_lazy_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}//end foreach
|
||||
|
||||
echo '</table>';
|
||||
|
@@ -360,7 +360,7 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
|
||||
}
|
||||
|
||||
foreach ($config['nfsen_rrds'] as $nfsenrrds) {
|
||||
if ($configs[(strlen($nfsenrrds) - 1)] != '/') {
|
||||
if ($nfsenrrds[(strlen($nfsenrrds) - 1)] != '/') {
|
||||
$nfsenrrds .= '/';
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
|
||||
}
|
||||
|
||||
$basefilename_underscored = preg_replace('/\./', $config['nfsen_split_char'], $device['hostname']);
|
||||
$nfsen_filename = (strstr($basefilename_underscored, $nfsensuffix, true));
|
||||
$nfsen_filename = preg_replace('/'.$nfsensuffix.'/', '', $basefilename_underscored);
|
||||
if (is_file($nfsenrrds.$nfsen_filename.'.rrd')) {
|
||||
$nfsen_rrd_file = $nfsenrrds.$nfsen_filename.'.rrd';
|
||||
}
|
||||
|
@@ -18,11 +18,14 @@ foreach ($graphs as $key => $text) {
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
$graph_array['type'] = 'application_'.$key;
|
||||
|
||||
echo '<h3>'.$text.'</h3>';
|
||||
|
||||
echo "<tr bgcolor='$row_colour'><td colspan=5>";
|
||||
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.$text.'</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">';
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
|
||||
echo '</td></tr>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
28
html/pages/device/apps/dhcp-stats.inc.php
Normal file
28
html/pages/device/apps/dhcp-stats.inc.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
global $config;
|
||||
|
||||
$graphs = array(
|
||||
'dhcp-stats' => 'DHCP Stats',
|
||||
);
|
||||
|
||||
foreach ($graphs as $key => $text) {
|
||||
$graph_type = $key;
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '215';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
$graph_array['type'] = 'application_'.$key;
|
||||
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.$text.'</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">';
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
@@ -3,13 +3,13 @@
|
||||
global $config;
|
||||
|
||||
$graphs = array(
|
||||
'nfs-v3-stats' => 'NFS v3 Statistics',
|
||||
'nfs-io' => 'IO',
|
||||
'nfs-fh' => 'File handler',
|
||||
'nfs-rc' => 'Reply cache',
|
||||
'nfs-ra' => 'Read ahead cache',
|
||||
'nfs-net' => 'Network stats',
|
||||
'nfs-rpc' => 'RPC Stats',
|
||||
'nfs-v3-stats_stats' => 'NFS v3 Statistics',
|
||||
'nfs-v3-stats_io' => 'IO',
|
||||
'nfs-v3-stats_fh' => 'File handler',
|
||||
'nfs-v3-stats_rc' => 'Reply cache',
|
||||
'nfs-v3-stats_ra' => 'Read ahead cache',
|
||||
'nfs-v3-stats_net' => 'Network stats',
|
||||
'nfs-v3-stats_rpc' => 'RPC Stats',
|
||||
|
||||
);
|
||||
|
||||
|
28
html/pages/device/apps/os-updates.inc.php
Normal file
28
html/pages/device/apps/os-updates.inc.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
global $config;
|
||||
|
||||
$graphs = array(
|
||||
'os-updates' => 'OS updates',
|
||||
);
|
||||
|
||||
foreach ($graphs as $key => $text) {
|
||||
$graph_type = $key;
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '215';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
$graph_array['type'] = 'application_'.$key;
|
||||
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.$text.'</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">';
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
53
html/pages/device/apps/powerdns-recursor.inc.php
Normal file
53
html/pages/device/apps/powerdns-recursor.inc.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* powerdns-recursor.php
|
||||
*
|
||||
* Graphs for PowerDNS Recursor
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2016 Tony Murray
|
||||
* @author Tony Murray <murraytony@gmail.com>
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
$graphs = array(
|
||||
'powerdns-recursor_questions' => 'Questions',
|
||||
'powerdns-recursor_answers' => 'Answers',
|
||||
'powerdns-recursor_cache_performance' => 'Cache Performance',
|
||||
'powerdns-recursor_cache_size' => 'Cache Size',
|
||||
'powerdns-recursor_outqueries' => 'Outbound Queries',
|
||||
);
|
||||
|
||||
foreach ($graphs as $key => $text) {
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '215';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
$graph_array['type'] = 'application_'.$key;
|
||||
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.$text.'</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">';
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
@@ -80,7 +80,7 @@ foreach ($applications as $app) {
|
||||
echo ' <td>';
|
||||
echo ' <input type=checkbox'.(in_array($app, $app_enabled) ? ' checked="1"' : '')." name='app_".$app."'>";
|
||||
echo ' </td>';
|
||||
echo ' <td>'.ucfirst($app).'</td>';
|
||||
echo ' <td>'.nicecase($app).'</td>';
|
||||
echo ' </tr>
|
||||
';
|
||||
|
||||
|
@@ -44,13 +44,27 @@
|
||||
event.preventDefault();
|
||||
$('.ignore-check').prop('checked', true);
|
||||
});
|
||||
$('#alert-select').click(function (event) {
|
||||
// select ignore buttons for all ports which are down
|
||||
$('#warning-select').click(function (event) {
|
||||
// select ignore button for all components that are in a warning state.
|
||||
event.preventDefault();
|
||||
$('[name^="status_"]').each(function () {
|
||||
var name = $(this).attr('name');
|
||||
var text = $(this).text();
|
||||
if (name && text == 'Alert') {
|
||||
if (name && text == 'Warning') {
|
||||
// get the component number from the object name
|
||||
var id = name.split('_')[1];
|
||||
// find its corresponding checkbox and toggle it
|
||||
$('input[name="ign_' + id + '"]').trigger('click');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#critical-select').click(function (event) {
|
||||
// select ignore button for all components that are in a critical state.
|
||||
event.preventDefault();
|
||||
$('[name^="status_"]').each(function () {
|
||||
var name = $(this).attr('name');
|
||||
var text = $(this).text();
|
||||
if (name && text == 'Critical') {
|
||||
// get the component number from the object name
|
||||
var id = name.split('_')[1];
|
||||
// find its corresponding checkbox and toggle it
|
||||
|
@@ -2,27 +2,30 @@
|
||||
<hr />
|
||||
|
||||
<form method="post" action="">
|
||||
<label><strong>Search</strong>
|
||||
<input type="text" name="string" id="string" value="<?php echo $_POST['string']; ?>" />
|
||||
</label>
|
||||
<label>
|
||||
<strong>Program</strong>
|
||||
<select name="program" id="program">
|
||||
<option value="">All Programs</option>
|
||||
<?php
|
||||
$datas = dbFetchRows('SELECT `program` FROM `syslog` WHERE device_id = ? GROUP BY `program` ORDER BY `program`', array($device['device_id']));
|
||||
foreach ($datas as $data) {
|
||||
echo "<option value='".$data['program']."'";
|
||||
if ($data['program'] == $_POST['program']) {
|
||||
echo 'selected';
|
||||
}
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<input class="form-control" type="text" name="string" palaceholder="Search" id="string" value="<?php echo $_POST['string']; ?>">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<select name="program" class="form-control" id="program">
|
||||
<option value="">All Programs</option>
|
||||
<?php
|
||||
$datas = dbFetchRows('SELECT `program` FROM `syslog` WHERE device_id = ? GROUP BY `program` ORDER BY `program`', array($device['device_id']));
|
||||
foreach ($datas as $data) {
|
||||
echo "<option value='".$data['program']."'";
|
||||
if ($data['program'] == $_POST['program']) {
|
||||
echo 'selected';
|
||||
}
|
||||
|
||||
echo '>'.$data['program'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</label>
|
||||
<input class=submit type=submit value=Search>
|
||||
echo '>'.$data['program'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input class="btn btn-default" type="submit" value="Search">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
@@ -19,7 +19,7 @@ global $config;
|
||||
// Loop over each component, pulling out the Overlays.
|
||||
foreach ($components as $oid => $overlay) {
|
||||
if ($overlay['otvtype'] == 'overlay') {
|
||||
if ($overlay['status'] == 1) {
|
||||
if ($overlay['status'] == 0) {
|
||||
$overlay_status = "<span class='green pull-right'>Normal</span>";
|
||||
$gli = "";
|
||||
}
|
||||
@@ -33,7 +33,7 @@ foreach ($components as $oid => $overlay) {
|
||||
<?php
|
||||
foreach ($components as $aid => $adjacency) {
|
||||
if (($adjacency['otvtype'] == 'adjacency') && ($adjacency['index'] == $overlay['index'])) {
|
||||
if ($adjacency['status'] == 1) {
|
||||
if ($adjacency['status'] == 0) {
|
||||
$adj_status = "<span class='green pull-right'>Normal</span>";
|
||||
$gli = "";
|
||||
}
|
||||
|
@@ -1,17 +1,19 @@
|
||||
<?php
|
||||
|
||||
$link_array = array(
|
||||
'page' => 'device',
|
||||
'device' => $device['device_id'],
|
||||
'tab' => 'routing',
|
||||
'proto' => 'ipsec_tunnels',
|
||||
);
|
||||
'page' => 'device',
|
||||
'device' => $device['device_id'],
|
||||
'tab' => 'routing',
|
||||
'proto' => 'ipsec_tunnels'
|
||||
);
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
echo "<span style='font-weight: bold;'>IPSEC Tunnels</span> » ";
|
||||
|
||||
$menu_options = array('basic' => 'Basic');
|
||||
$menu_options = array(
|
||||
'basic' => 'Basic'
|
||||
);
|
||||
|
||||
if (!isset($vars['view'])) {
|
||||
$vars['view'] = 'basic';
|
||||
@@ -19,8 +21,8 @@ if (!isset($vars['view'])) {
|
||||
|
||||
echo "<span style='font-weight: bold;'>VRFs</span> » ";
|
||||
|
||||
$menu_options = array('basic' => 'Basic',
|
||||
// 'detail' => 'Detail',
|
||||
$menu_options = array(
|
||||
'basic' => 'Basic'
|
||||
);
|
||||
|
||||
if (!$_GET['opta']) {
|
||||
@@ -32,83 +34,98 @@ foreach ($menu_options as $option => $text) {
|
||||
if ($vars['view'] == $option) {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo generate_link($text, $link_array, array('view' => $option));
|
||||
|
||||
echo generate_link($text, $link_array, array(
|
||||
'view' => $option
|
||||
));
|
||||
if ($vars['view'] == $option) {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
|
||||
echo ' | ';
|
||||
}
|
||||
|
||||
echo ' Graphs: ';
|
||||
|
||||
$graph_types = array(
|
||||
'bits' => 'Bits',
|
||||
'pkts' => 'Packets',
|
||||
);
|
||||
'bits' => 'Bits',
|
||||
'pkts' => 'Packets'
|
||||
);
|
||||
|
||||
foreach ($graph_types as $type => $descr) {
|
||||
echo "$type_sep";
|
||||
if ($vars['graph'] == $type) {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo generate_link($descr, $link_array, array('view' => 'graphs', 'graph' => $type));
|
||||
|
||||
echo generate_link($descr, $link_array, array(
|
||||
'view' => 'graphs',
|
||||
'graph' => $type
|
||||
));
|
||||
if ($vars['graph'] == $type) {
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
|
||||
$type_sep = ' | ';
|
||||
}
|
||||
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
echo "<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=0 width=100%>";
|
||||
$i = '0';
|
||||
foreach (dbFetchRows('SELECT * FROM `ipsec_tunnels` WHERE `device_id` = ? ORDER BY `peer_addr`', array($device['device_id'])) as $tunnel) {
|
||||
if (is_integer($i / 2)) {
|
||||
$bg_colour = $list_colour_a;
|
||||
}
|
||||
else {
|
||||
$bg_colour = $list_colour_b;
|
||||
}
|
||||
$tunnel = dbFetchRows('SELECT * FROM `ipsec_tunnels` WHERE `device_id` = ? ORDER BY `peer_addr`', array(
|
||||
$device['device_id']
|
||||
));
|
||||
|
||||
if ($tunnel['tunnel_status'] == 'active') {
|
||||
$tunnel_class = 'green';
|
||||
if (is_null($vars['graph'])) {
|
||||
$tunnel_label = 'warning';
|
||||
echo '<table class="table table-condensed table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Local Identity</th>
|
||||
<th>Remote Identity</th>
|
||||
<th>Name</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
|
||||
foreach ($tunnel as $entry) {
|
||||
$local_addr = preg_replace('/\b0+(?=\d)/', '', htmlentities($entry['local_addr']));
|
||||
$remote_addr = preg_replace('/\b0+(?=\d)/', '', htmlentities($entry['peer_addr']));
|
||||
|
||||
if ($tunnel['tunnel_status'] = 'active') {
|
||||
$tunnel_label = 'success';
|
||||
}
|
||||
echo '<tr>
|
||||
<td>' . $local_addr . '</td>
|
||||
<td>' . $remote_addr . '</td>
|
||||
<td>' . htmlentities($entry['tunnel_name']) . '</td>
|
||||
<td><span class="label label-' . $tunnel_label . '">' . htmlentities($entry['tunnel_status']) . '</span></td>
|
||||
</tr>';
|
||||
}
|
||||
else {
|
||||
$tunnel_class = 'red';
|
||||
}
|
||||
|
||||
echo "<tr bgcolor='$bg_colour'>";
|
||||
echo '<td width=320 class=list-large>'.$tunnel['local_addr'].' » '.$tunnel['peer_addr'].'</a></td>';
|
||||
echo '<td width=150 class=box-desc>'.$tunnel['tunnel_name'].'</td>';
|
||||
echo "<td width=100 class=list-large><span class='".$tunnel_class."'>".$tunnel['tunnel_status'].'</span></td>';
|
||||
echo '</tr>';
|
||||
if (isset($vars['graph'])) {
|
||||
echo '<tr class="list-bold">';
|
||||
echo '<td colspan = 3>';
|
||||
$graph_type = 'ipsectunnel_'.$vars['graph'];
|
||||
|
||||
|
||||
echo '</tbody>
|
||||
</table>';
|
||||
} else {
|
||||
foreach ($tunnel as $entry) {
|
||||
$local_addr = preg_replace('/\b0+(?=\d)/', '', htmlentities($entry['local_addr']));
|
||||
$remote_addr = preg_replace('/\b0+(?=\d)/', '', htmlentities($entry['peer_addr']));
|
||||
|
||||
$graph_type = 'ipsectunnel_' . $vars['graph'];
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '215';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $tunnel['tunnel_id'];
|
||||
$graph_array['id'] = $entry['tunnel_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">' . $local_addr . ' » ' . $remote_addr . '</h3>
|
||||
</div>
|
||||
<div class="panel-body">';
|
||||
echo "<div class='row'>";
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
|
||||
echo '
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
$i++;
|
||||
}//end foreach
|
||||
|
||||
echo '</table></div>';
|
||||
}
|
||||
|
@@ -1,192 +1,178 @@
|
||||
<?php
|
||||
|
||||
$i_i = '0';
|
||||
$i = 0;
|
||||
|
||||
echo '<table width=100% border=0 cellpadding=5>';
|
||||
|
||||
// Loop Instances
|
||||
echo '
|
||||
<div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<table class="table table-condensed" style="border-collapse:collapse;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Router ID</th>
|
||||
<th>Status</th>
|
||||
<th>ABR</th>
|
||||
<th>ASBR</th>
|
||||
<th>Areas</th>
|
||||
<th>Ports(Enabled)</th>
|
||||
<th>Neighbours</th>
|
||||
</tr>
|
||||
</thead>';
|
||||
foreach (dbFetchRows('SELECT * FROM `ospf_instances` WHERE `device_id` = ?', array($device['device_id'])) as $instance) {
|
||||
if (!is_integer($i_i / 2)) {
|
||||
$instance_bg = $list_colour_a;
|
||||
}
|
||||
else {
|
||||
$instance_bg = $list_colour_b;
|
||||
}
|
||||
|
||||
$i++;
|
||||
$area_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = ?', array($device['device_id']));
|
||||
$port_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = ?', array($device['device_id']));
|
||||
$port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = ?", array($device['device_id']));
|
||||
$nbr_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = ?', array($device['device_id']));
|
||||
|
||||
$query = 'SELECT * FROM ipv4_addresses AS A, ports AS I WHERE ';
|
||||
$query .= '(A.ipv4_address = ? AND I.port_id = A.port_id)';
|
||||
$query .= ' AND I.device_id = ?';
|
||||
$ipv4_host = dbFetchRow($query, array($peer['bgpPeerIdentifier'], $device['device_id']));
|
||||
|
||||
$status_color = $abr_status_color = $asbr_status_color = 'default';
|
||||
|
||||
if ($instance['ospfAdminStat'] == 'enabled') {
|
||||
$enabled = '<span style="color: #00aa00">enabled</span>';
|
||||
}
|
||||
else {
|
||||
$enabled = '<span style="color: #aaaaaa">disabled</span>';
|
||||
$status_color = 'success';
|
||||
}
|
||||
|
||||
if ($instance['ospfAreaBdrRtrStatus'] == 'true') {
|
||||
$abr = '<span style="color: #00aa00">yes</span>';
|
||||
}
|
||||
else {
|
||||
$abr = '<span style="color: #aaaaaa">no</span>';
|
||||
$abr_status_color = 'success';
|
||||
}
|
||||
|
||||
if ($instance['ospfASBdrRtrStatus'] == 'true') {
|
||||
$asbr = '<span style="color: #00aa00">yes</span>';
|
||||
$asbr_status_color = 'success';
|
||||
}
|
||||
else {
|
||||
$asbr = '<span style="color: #aaaaaa">no</span>';
|
||||
}
|
||||
|
||||
echo '<tr><th>Router Id</th><th>Status</th><th>ABR</th><th>ASBR</th><th>Areas</th><th>Ports</th><th>Neighbours</th></tr>';
|
||||
echo '<tr bgcolor="'.$instance_bg.'">';
|
||||
echo ' <td class="list-large">'.$instance['ospfRouterId'].'</td>';
|
||||
echo ' <td>'.$enabled.'</td>';
|
||||
echo ' <td>'.$abr.'</td>';
|
||||
echo ' <td>'.$asbr.'</td>';
|
||||
echo ' <td>'.$area_count.'</td>';
|
||||
echo ' <td>'.$port_count.'('.$port_count_enabled.')</td>';
|
||||
echo ' <td>'.$nbr_count.'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr bgcolor="'.$instance_bg.'">';
|
||||
echo '<td colspan=7>';
|
||||
echo '<table width=100% border=0 cellpadding=5>';
|
||||
echo '<tr><th></th><th>Area Id</th><th>Status</th><th>Ports</th></tr>';
|
||||
|
||||
// # Loop Areas
|
||||
$i_a = 0;
|
||||
|
||||
echo '
|
||||
<tbody>
|
||||
<tr data-toggle="collapse" data-target="#ospf-panel' . $i . '" class="accordion-toggle">
|
||||
<td><button class="btn btn-default btn-xs"><span class="fa fa-plus"></span></button></td>
|
||||
<td>' . $instance['ospfRouterId'] . '</td>
|
||||
<td><span class="label label-' . $status_color . '">' . $instance['ospfAdminStat'] . '</span></td>
|
||||
<td><span class="label label-' . $abr_status_color . '">' . $instance['ospfAreaBdrRtrStatus'] . '</span></td>
|
||||
<td><span class="label label-' . $asbr_status_color . '">' . $instance['ospfASBdrRtrStatus'] . '</span></td>
|
||||
<td>' . $area_count . '</td>
|
||||
<td>' . $port_count . '(' . $port_count_enabled . ')</td>
|
||||
<td>' . $nbr_count . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="12" class="hiddenRow">
|
||||
<div class="accordian-body collapse" id="ospf-panel' . $i . '">
|
||||
<br>
|
||||
<div class="col-xs-4">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<h4><span class="label label-primary">Areas</span></h4>
|
||||
<tr>
|
||||
<th>Area ID</th>
|
||||
<th>Ports(Enabled)</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>';
|
||||
foreach (dbFetchRows('SELECT * FROM `ospf_areas` WHERE `device_id` = ?', array($device['device_id'])) as $area) {
|
||||
if (!is_integer($i_a / 2)) {
|
||||
$area_bg = $list_colour_b_a;
|
||||
}
|
||||
else {
|
||||
$area_bg = $list_colour_b_b;
|
||||
}
|
||||
|
||||
|
||||
$area_port_count = dbFetchCell('SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = ? AND `ospfIfAreaId` = ?', array($device['device_id'], $area['ospfAreaId']));
|
||||
$area_port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = ? AND `ospfIfAreaId` = ?", array($device['device_id'], $area['ospfAreaId']));
|
||||
|
||||
echo '
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>' . $area['ospfAreaId'] . '</td>
|
||||
<td>' . $area_port_count . '(' . $area_port_count_enabled . ')</td>
|
||||
<td><span class="label label-' . $status_color . '">' . $instance['ospfAdminStat'] . '</span></td>
|
||||
</tr>
|
||||
</tbody>';
|
||||
}
|
||||
echo '
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<h4><span class="label label-primary">Ports</span></h4>
|
||||
<tr>
|
||||
<th>Port</th>
|
||||
<th>Port Type</th>
|
||||
<th>Port State</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</div>';
|
||||
foreach (dbFetchRows("SELECT * FROM `ospf_ports` AS O, `ports` AS P WHERE O.`ospfIfAdminStat` = 'enabled' AND O.`device_id` = ? AND O.`ospfIfAreaId` = ? AND P.port_id = O.port_id", array($device['device_id'], $area['ospfAreaId'])) as $ospfport) {
|
||||
|
||||
echo '<tr bgcolor="'.$area_bg.'">';
|
||||
echo ' <td width=5></td>';
|
||||
echo ' <td class="list-large">'.$area['ospfAreaId'].'</td>';
|
||||
echo ' <td>'.$enabled.'</td>';
|
||||
echo ' <td>'.$area_port_count.'('.$area_port_count_enabled.')</td>';
|
||||
echo '</tr>';
|
||||
$port_status_color = 'default';
|
||||
|
||||
echo '<tr bgcolor="'.$area_bg.'">';
|
||||
echo '<td colspan=7>';
|
||||
echo '<table width=100% border=0 cellpadding=5>';
|
||||
echo '<tr><th></th><th>Port</th><th>Status</th><th>Port Type</th><th>Port State</th></tr>';
|
||||
|
||||
// # Loop Ports
|
||||
$i_p = ($i_a + 1);
|
||||
$p_sql = "SELECT * FROM `ospf_ports` AS O, `ports` AS P WHERE O.`ospfIfAdminStat` = 'enabled' AND O.`device_id` = ? AND O.`ospfIfAreaId` = ? AND P.port_id = O.port_id";
|
||||
foreach (dbFetchRows($p_sql, array($device['device_id'], $area['ospfAreaId'])) as $ospfport) {
|
||||
if (!is_integer($i_a / 2)) {
|
||||
if (!is_integer($i_p / 2)) {
|
||||
$port_bg = $list_colour_b_b;
|
||||
}
|
||||
else {
|
||||
$port_bg = $list_colour_b_a;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!is_integer($i_p / 2)) {
|
||||
$port_bg = $list_colour_a_b;
|
||||
}
|
||||
else {
|
||||
$port_bg = $list_colour_a_a;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ospfport['ospfIfAdminStat'] == 'enabled') {
|
||||
$port_enabled = '<span style="color: #00aa00">enabled</span>';
|
||||
}
|
||||
else {
|
||||
$port_enabled = '<span style="color: #aaaaaa">disabled</span>';
|
||||
}
|
||||
|
||||
echo '<tr bgcolor="'.$port_bg.'">';
|
||||
echo ' <td width=15></td>';
|
||||
echo ' <td><strong>'.generate_port_link($ospfport).'</strong></td>';
|
||||
echo ' <td>'.$port_enabled.'</td>';
|
||||
echo ' <td>'.$ospfport['ospfIfType'].'</td>';
|
||||
echo ' <td>'.$ospfport['ospfIfState'].'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
$i_p++;
|
||||
}//end foreach
|
||||
|
||||
echo '</table>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
$i_a++;
|
||||
} //end foreach
|
||||
|
||||
echo '<tr bgcolor="#ffffff"><th></th><th>Router Id</th><th>Device</th><th>IP Address</th><th>Status</th></tr>';
|
||||
|
||||
// Loop Neigbours
|
||||
$i_n = 1;
|
||||
if ($ospfport['ospfIfAdminStat'] == 'enabled') {
|
||||
$port_status_color = 'success';
|
||||
}
|
||||
|
||||
echo '
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>' . generate_port_link($ospfport) . '</td>
|
||||
<td>' . $ospfport['ospfIfType'] . '</td>
|
||||
<td>' . $ospfport['ospfIfState'] . '</td>
|
||||
<td><span class="label label-' . $port_status_color . '">' . $ospfport['ospfIfAdminStat'] . '</span></td>
|
||||
</tr>
|
||||
</tbody>';
|
||||
}
|
||||
echo '
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<h4><span class="label label-primary">Neighbours</span></h4>
|
||||
<tr>
|
||||
<th>Router ID</th>
|
||||
<th>Device</th>
|
||||
<th>IP Address</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>';
|
||||
foreach (dbFetchRows('SELECT * FROM `ospf_nbrs` WHERE `device_id` = ?', array($device['device_id'])) as $nbr) {
|
||||
if (!is_integer($i_n / 2)) {
|
||||
$nbr_bg = $list_colour_b_a;
|
||||
}
|
||||
else {
|
||||
$nbr_bg = $list_colour_b_b;
|
||||
}
|
||||
|
||||
$host = @dbFetchRow(
|
||||
'SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ?
|
||||
AND I.port_id = A.port_id AND D.device_id = I.device_id',
|
||||
array($nbr['ospfNbrRtrId'])
|
||||
);
|
||||
|
||||
$host = @dbFetchRow('SELECT * FROM `ipv4_addresses` AS A, `ports` AS I, `devices` AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', array($nbr['ospfNbrRtrId']));
|
||||
|
||||
$rtr_id = 'unknown';
|
||||
$ospfnbr_status_color = 'default';
|
||||
|
||||
if (is_array($host)) {
|
||||
$rtr_id = generate_device_link($host);
|
||||
}
|
||||
else {
|
||||
$rtr_id = 'unknown';
|
||||
|
||||
if ($nbr['ospfNbrState'] == 'full') {
|
||||
$ospfnbr_status_color = 'success';
|
||||
}
|
||||
elseif ($nbr['ospfNbrState'] == 'down') {
|
||||
$ospfnbr_status_color = 'danger';
|
||||
}
|
||||
|
||||
echo '<tr bgcolor="'.$nbr_bg.'">';
|
||||
echo ' <td width=5></td>';
|
||||
echo ' <td><span class="list-large">'.$nbr['ospfNbrRtrId'].'</span></td>';
|
||||
echo ' <td>'.$rtr_id.'</td>';
|
||||
echo ' <td>'.$nbr['ospfNbrIpAddr'].'</td>';
|
||||
echo ' <td>';
|
||||
switch ($nbr['ospfNbrState']) {
|
||||
case 'full':
|
||||
echo '<span class=green>'.$nbr['ospfNbrState'].'</span>';
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
echo '<span class=red>'.$nbr['ospfNbrState'].'</span>';
|
||||
break;
|
||||
|
||||
default:
|
||||
echo '<span class=blue>'.$nbr['ospfNbrState'].'</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
$i_n++;
|
||||
}//end foreach
|
||||
|
||||
echo '</table>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
$i_i++;
|
||||
} //end foreach
|
||||
|
||||
echo '</table>';
|
||||
echo '
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>' . $nbr['ospfNbrRtrId'] . '</td>
|
||||
<td>' . $rtr_id . '</td>
|
||||
<td>' . $nbr['ospfNbrIpAddr'] . '</td>
|
||||
<td><span class="label label-' . $ospfnbr_status_color . '">' . $nbr['ospfNbrState'] . '</span></td>
|
||||
</tr>
|
||||
</tbody>';
|
||||
}
|
||||
echo '
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>';
|
||||
}
|
||||
echo '
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
|
@@ -438,11 +438,11 @@ if (passwordscanchange($users_details['username'])) {
|
||||
}//end if
|
||||
}
|
||||
else {
|
||||
echo print_error('Error getting user details');
|
||||
print_error('Error getting user details');
|
||||
}//end if
|
||||
}
|
||||
else {
|
||||
echo print_error("Authentication method doesn't support updating users");
|
||||
print_error("Authentication method doesn't support updating users");
|
||||
}//end if
|
||||
}//end if
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ foreach ($COMPONENTS as $DEVICE_ID => $COMP) {
|
||||
// Loop over each component, pulling out the Overlays.
|
||||
foreach ($COMP as $OID => $OVERLAY) {
|
||||
if ($OVERLAY['otvtype'] == 'overlay') {
|
||||
if ($OVERLAY['status'] == 1) {
|
||||
if ($OVERLAY['status'] == 0) {
|
||||
$OVERLAY_STATUS = "<span class='green pull-right'>Normal</span>";
|
||||
$GLI = "";
|
||||
}
|
||||
@@ -33,7 +33,7 @@ foreach ($COMPONENTS as $DEVICE_ID => $COMP) {
|
||||
<?php
|
||||
foreach ($COMP as $AID => $ADJACENCY) {
|
||||
if (($ADJACENCY['otvtype'] == 'adjacency') && ($ADJACENCY['index'] == $OVERLAY['index'])) {
|
||||
if ($ADJACENCY['status'] == 1) {
|
||||
if ($ADJACENCY['status'] == 0) {
|
||||
$ADJ_STATUS = "<span class='green pull-right'>Normal</span>";
|
||||
$GLI = "";
|
||||
}
|
||||
|
@@ -1,65 +1,61 @@
|
||||
<?php
|
||||
|
||||
$i_i = '0';
|
||||
|
||||
echo '<table width=100% border=0 cellpadding=10>';
|
||||
echo '<tr><th>Device</th><th>Router Id</th><th>Status</th><th>ABR</th><th>ASBR</th><th>Areas</th><th>Ports</th><th>Neighbours</th></tr>';
|
||||
|
||||
// Loop Instances
|
||||
echo '
|
||||
<div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<table class="table table-condensed" style="border-collapse:collapse;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Device</th>
|
||||
<th>Router ID</th>
|
||||
<th>Status</th>
|
||||
<th>ABR</th>
|
||||
<th>ASBR</th>
|
||||
<th>Areas</th>
|
||||
<th>Ports(Enabled)</th>
|
||||
<th>Neighbours</th>
|
||||
</tr>
|
||||
</thead>';
|
||||
foreach (dbFetchRows("SELECT * FROM `ospf_instances` WHERE `ospfAdminStat` = 'enabled'") as $instance) {
|
||||
if (!is_integer($i_i / 2)) {
|
||||
$instance_bg = $list_colour_a;
|
||||
}
|
||||
else {
|
||||
$instance_bg = $list_colour_b;
|
||||
}
|
||||
|
||||
$device = device_by_id_cache($instance['device_id']);
|
||||
$device = device_by_id_cache($instance['device_id']);
|
||||
$area_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = '" . $device['device_id'] . "'");
|
||||
$port_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = '" . $device['device_id'] . "'");
|
||||
$port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = '" . $device['device_id'] . "'");
|
||||
$nbr_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = '" . $device['device_id'] . "'");
|
||||
|
||||
$area_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = '".$device['device_id']."'");
|
||||
$port_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = '".$device['device_id']."'");
|
||||
$port_count_enabled = dbFetchCell("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = '".$device['device_id']."'");
|
||||
$neighbour_count = dbFetchCell("SELECT COUNT(*) FROM `ospf_nbrs` WHERE `device_id` = '".$device['device_id']."'");
|
||||
|
||||
$ip_query = 'SELECT * FROM ipv4_addresses AS A, ports AS I WHERE ';
|
||||
$ip_query .= '(A.ipv4_address = ? AND I.port_id = A.port_id)';
|
||||
$ip_query .= ' AND I.device_id = ?';
|
||||
|
||||
$ipv4_host = dbFetchRow($ip_query, array($peer['bgpPeerIdentifier'], $device['device_id']));
|
||||
$status_color = $abr_status_color = $asbr_status_color = 'default';
|
||||
|
||||
if ($instance['ospfAdminStat'] == 'enabled') {
|
||||
$enabled = '<span style="color: #00aa00">enabled</span>';
|
||||
}
|
||||
else {
|
||||
$enabled = '<span style="color: #aaaaaa">disabled</span>';
|
||||
$status_color = 'success';
|
||||
}
|
||||
|
||||
if ($instance['ospfAreaBdrRtrStatus'] == 'true') {
|
||||
$abr = '<span style="color: #00aa00">yes</span>';
|
||||
}
|
||||
else {
|
||||
$abr = '<span style="color: #aaaaaa">no</span>';
|
||||
$abr_status_color = 'success';
|
||||
}
|
||||
|
||||
if ($instance['ospfASBdrRtrStatus'] == 'true') {
|
||||
$asbr = '<span style="color: #00aa00">yes</span>';
|
||||
}
|
||||
else {
|
||||
$asbr = '<span style="color: #aaaaaa">no</span>';
|
||||
$asbr_status_color = 'success';
|
||||
}
|
||||
|
||||
echo '<tr bgcolor="'.$instance_bg.'">';
|
||||
echo ' <td class="list-large">'.generate_device_link($device, 0, array('tab' => 'routing', 'proto' => 'ospf')).'</td>';
|
||||
echo ' <td class="list-large">'.$instance['ospfRouterId'].'</td>';
|
||||
echo ' <td>'.$enabled.'</td>';
|
||||
echo ' <td>'.$abr.'</td>';
|
||||
echo ' <td>'.$asbr.'</td>';
|
||||
echo ' <td>'.$area_count.'</td>';
|
||||
echo ' <td>'.$port_count.'('.$port_count_enabled.')</td>';
|
||||
echo ' <td>'.$neighbour_count.'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
$i_i++;
|
||||
} //end foreach
|
||||
|
||||
echo '</table>';
|
||||
echo '
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>' . generate_device_link($device, 0, array('tab' => 'routing', 'proto' => 'ospf')) . '</td>
|
||||
<td>' . $instance['ospfRouterId'] . '</td>
|
||||
<td><span class="label label-' . $status_color . '">' . $instance['ospfAdminStat'] . '</span></td>
|
||||
<td><span class="label label-' . $abr_status_color . '">' . $instance['ospfAreaBdrRtrStatus'] . '</span></td>
|
||||
<td><span class="label label-' . $asbr_status_color . '">' . $instance['ospfASBdrRtrStatus'] . '</span></td>
|
||||
<td>' . $area_count . '</td>
|
||||
<td>' . $port_count . '(' . $port_count_enabled . ')</td>
|
||||
<td>' . $nbr_count . '</td>
|
||||
</tr>
|
||||
</tbody>';
|
||||
}
|
||||
echo '</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
|
@@ -10,86 +10,82 @@ if ($vars['action'] == 'expunge' && $_SESSION['userlevel'] >= '10') {
|
||||
}
|
||||
|
||||
$pagetitle[] = 'Syslog';
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
?>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="syslog" class="table table-hover table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="timestamp" data-order="desc">Datetime</th>
|
||||
<th data-column-id="device_id">Hostname</th>
|
||||
<th data-column-id="program">Program</th>
|
||||
<th data-column-id="msg">Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<div id="{{ctx.id}}" class="{{css.header}}">
|
||||
<div class="row">
|
||||
<div class="col-sm-9 actionBar">
|
||||
<div class="pull-left">
|
||||
<form method="post" action="" class="form-inline" role="form" id="result_form">
|
||||
<div class="form-group">
|
||||
<select name="device" id="device" class="form-control input-sm">
|
||||
<option value="">All Devices</option>
|
||||
<?php
|
||||
foreach (get_all_devices() as $hostname) {
|
||||
$device_id = getidbyname($hostname);
|
||||
if (device_permitted($device_id)) {
|
||||
echo '"<option value="'.$device_id.'"';
|
||||
if ($device_id == $vars['device']) {
|
||||
echo ' selected';
|
||||
}
|
||||
|
||||
echo '>'.$hostname.'</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<select name="program" id="program" class="form-control input-sm">
|
||||
<option value="">All Programs</option>
|
||||
<?php
|
||||
foreach (dbFetchRows('SELECT DISTINCT `program` FROM `syslog` ORDER BY `program`') as $data) {
|
||||
echo '"<option value="'.$data['program'].'"';
|
||||
if ($data['program'] == $vars['program']) {
|
||||
echo ' selected';
|
||||
}
|
||||
|
||||
echo '>'.$data['program'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<select name="priority" id="priority" class="form-control input-sm">
|
||||
<option value="">All Priorities</option>
|
||||
<?php
|
||||
foreach (dbFetchRows('SELECT DISTINCT `priority` FROM `syslog` ORDER BY `level`') as $data) {
|
||||
echo '"<option value="'.$data['priority'].'"';
|
||||
if ($data['priority'] == $vars['priority']) {
|
||||
echo ' selected';
|
||||
}
|
||||
|
||||
echo '>'.$data['priority'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input name="from" type="text" class="form-control input-sm" id="dtpickerfrom" maxlength="16" value="<?php echo $vars['from']; ?>" placeholder="From" data-date-format="YYYY-MM-DD HH:mm">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input name="to" type="text" class="form-control input-sm" id="dtpickerto" maxlength="16" value="<?php echo $vars['to']; ?>" placeholder="To" data-date-format="YYYY-MM-DD HH:mm">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default input-sm">Filter</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3 actionBar">
|
||||
<p class="{{css.actions}}"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var grid = $("#syslog").bootgrid({
|
||||
ajax: true,
|
||||
templates: {
|
||||
header: "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\"><div class=\"row\">"+
|
||||
"<div class=\"col-sm-9 actionBar\"><span class=\"pull-left\">"+
|
||||
"<form method=\"post\" action=\"\" class=\"form-inline\" role=\"form\" id=\"result_form\">"+
|
||||
"<div class=\"form-group\">"+
|
||||
"<select name=\"device\" id=\"device\" class=\"form-control input-sm\">"+
|
||||
"<option value=\"\">All Devices</option>"+
|
||||
<?php
|
||||
foreach (get_all_devices() as $hostname) {
|
||||
$device_id = getidbyname($hostname);
|
||||
if (device_permitted($device_id)) {
|
||||
echo '"<option value=\"'.$device_id.'\"';
|
||||
if ($device_id == $vars['device']) {
|
||||
echo ' selected';
|
||||
}
|
||||
|
||||
echo '>'.$hostname.'</option>"+';
|
||||
}
|
||||
}
|
||||
?>
|
||||
"</select>"+
|
||||
"</div>"+
|
||||
"<div class=\"form-group\">"+
|
||||
"<select name=\"program\" id=\"program\" class=\"form-control input-sm\">"+
|
||||
"<option value=\"\">All Programs</option>"+
|
||||
<?php
|
||||
foreach (dbFetchRows('SELECT DISTINCT `program` FROM `syslog` ORDER BY `program`') as $data) {
|
||||
echo '"<option value=\"'.$data['program'].'\"';
|
||||
if ($data['program'] == $vars['program']) {
|
||||
echo ' selected';
|
||||
}
|
||||
|
||||
echo '>'.$data['program'].'</option>"+';
|
||||
}
|
||||
?>
|
||||
"</select>"+
|
||||
"</div>"+
|
||||
"<div class=\"form-group\">"+
|
||||
"<input name=\"from\" type=\"text\" class=\"form-control input-sm\" id=\"dtpickerfrom\" maxlength=\"16\" value=\"<?php echo $vars['from']; ?>\" placeholder=\"From\" data-date-format=\"YYYY-MM-DD HH:mm\">"+
|
||||
"</div>"+
|
||||
"<div class=\"form-group\">"+
|
||||
"<input name=\"to\" type=\"text\" class=\"form-control input-sm\" id=\"dtpickerto\" maxlength=\"16\" value=\"<?php echo $vars['to']; ?>\" placeholder=\"To\" data-date-format=\"YYYY-MM-DD HH:mm\">"+
|
||||
"</div>"+
|
||||
"<button type=\"submit\" class=\"btn btn-default input-sm\">Filter</button>"+
|
||||
"</form></span></div>"+
|
||||
"<div class=\"col-sm-3 actionBar\"><p class=\"{{css.actions}}\"></p></div></div></div>"
|
||||
|
||||
},
|
||||
post: function ()
|
||||
{
|
||||
return {
|
||||
id: "syslog",
|
||||
device: '<?php echo htmlspecialchars($vars['device']); ?>',
|
||||
program: '<?php echo htmlspecialchars($vars['program']); ?>',
|
||||
to: '<?php echo htmlspecialchars($vars['to']); ?>',
|
||||
from: '<?php echo htmlspecialchars($vars['from']); ?>',
|
||||
};
|
||||
},
|
||||
url: "ajax_table.php"
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$("#dtpickerfrom").datetimepicker();
|
||||
$("#dtpickerfrom").on("dp.change", function (e) {
|
||||
@@ -109,3 +105,10 @@ $(function () {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
print_optionbar_end();
|
||||
require_once 'includes/common/syslog.inc.php';
|
||||
echo implode('',$common_output);
|
||||
?>
|
||||
|
||||
|
@@ -281,5 +281,20 @@ function GetContacts($results) {
|
||||
$contacts[$user['email']] = $user['realname'];
|
||||
}
|
||||
}
|
||||
return $contacts;
|
||||
|
||||
$tmp_contacts = array();
|
||||
foreach ($contacts as $email => $name) {
|
||||
if (strstr($email, ',')) {
|
||||
$split_contacts = preg_split("/[,\s]+/", $email);
|
||||
foreach ($split_contacts as $split_email) {
|
||||
if(!empty($split_email)) {
|
||||
$tmp_contacts[$split_email] = $name;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$tmp_contacts[$email] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
return $tmp_contacts;
|
||||
}
|
||||
|
@@ -24,8 +24,17 @@
|
||||
foreach( $opts as $tmp_api ) {
|
||||
$host = $tmp_api['url'];
|
||||
$curl = curl_init();
|
||||
$slack_msg = strip_tags($obj['msg']);
|
||||
$color = ($obj['state'] == 0 ? '#00FF00' : '#FF0000');
|
||||
$data = array(
|
||||
'text' => $obj['msg'],
|
||||
'attachments' => array(
|
||||
0 => array(
|
||||
'fallback' => $slack_msg,
|
||||
'color' => $color,
|
||||
'title' => $obj['title'],
|
||||
'text' => $slack_msg,
|
||||
)
|
||||
),
|
||||
'channel' => $tmp_api['channel'],
|
||||
'username' => $tmp_api['username'],
|
||||
'icon_url' => $tmp_api['icon_url'],
|
||||
|
@@ -16,6 +16,21 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
function generate_priority_icon($priority) {
|
||||
$map = array(
|
||||
"emerg" => "server_delete",
|
||||
"alert" => "cancel",
|
||||
"crit" => "application_lightning",
|
||||
"err" => "application_delete",
|
||||
"warning" => "application_error",
|
||||
"notice" => "application_edit",
|
||||
"info" => "application",
|
||||
"debug" => "bug",
|
||||
);
|
||||
|
||||
return '<img src="images/16/' . $map[$priority] .'.png" title="' . $priority . '">';
|
||||
}
|
||||
|
||||
function format_number_short($number, $sf) {
|
||||
// This formats a number so that we only send back three digits plus an optional decimal point.
|
||||
// Example: 723.42 -> 723 72.34 -> 72.3 2.23 -> 2.23
|
||||
@@ -80,9 +95,13 @@ function isCli() {
|
||||
}
|
||||
}
|
||||
|
||||
function print_error($text) {
|
||||
global $console_color;
|
||||
function print_error($text, $quiet = false) {
|
||||
if ($quiet) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isCli()) {
|
||||
global $console_color;
|
||||
print $console_color->convert("%r".$text."%n\n", false);
|
||||
}
|
||||
else {
|
||||
@@ -90,9 +109,14 @@ function print_error($text) {
|
||||
}
|
||||
}
|
||||
|
||||
function print_message($text) {
|
||||
function print_message($text, $quiet = false) {
|
||||
if ($quiet) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isCli()) {
|
||||
print Console_Color2::convert("%g".$text."%n\n", false);
|
||||
global $console_color;
|
||||
print $console_color->convert("%g".$text."%n\n", false);
|
||||
}
|
||||
else {
|
||||
echo('<div class="alert alert-success"><img src="images/16/tick.png" align="absmiddle"> '.$text.'</div>');
|
||||
@@ -1038,7 +1062,7 @@ function version_info($remote=true) {
|
||||
curl_setopt($api, CURLOPT_RETURNTRANSFER, 1);
|
||||
$output['github'] = json_decode(curl_exec($api),true);
|
||||
}
|
||||
list($local_sha, $local_date) = explode('|', rtrim(`git show --pretty='%H|%ci' -s HEAD`));
|
||||
list($local_sha, $local_date) = explode('|', rtrim(`git show --pretty='%H|%ct' -s HEAD`));
|
||||
$output['local_sha'] = $local_sha;
|
||||
$output['local_date'] = $local_date;
|
||||
$output['local_branch'] = rtrim(`git rev-parse --abbrev-ref HEAD`);
|
||||
|
@@ -20,7 +20,7 @@ class component {
|
||||
private $reserved = array(
|
||||
'type' => '',
|
||||
'label' => '',
|
||||
'status' => 1,
|
||||
'status' => 0,
|
||||
'ignore' => 0,
|
||||
'disabled' => 0,
|
||||
'error' => '',
|
||||
@@ -148,6 +148,69 @@ class component {
|
||||
return $RESULT;
|
||||
}
|
||||
|
||||
public function getComponentStatus($device=null) {
|
||||
$sql_query = "SELECT status, count(status) as count FROM component WHERE";
|
||||
$sql_param = array();
|
||||
$add = 0;
|
||||
|
||||
if (!is_null($device)) {
|
||||
// Add a device filter to the SQL query.
|
||||
$sql_query .= " `device_id` = ?";
|
||||
$sql_param[] = $device;
|
||||
$add++;
|
||||
}
|
||||
|
||||
if ($add == 0) {
|
||||
// No filters, remove " WHERE" -6
|
||||
$sql_query = substr($sql_query, 0, strlen($sql_query)-6);
|
||||
}
|
||||
$sql_query .= " GROUP BY status";
|
||||
d_echo("SQL Query: ".$sql_query);
|
||||
|
||||
// $service is not null, get only what we want.
|
||||
$result = dbFetchRows($sql_query, $sql_param);
|
||||
|
||||
// Set our defaults to 0
|
||||
$count = array(0 => 0, 1 => 0, 2 => 0);
|
||||
// Rebuild the array in a more convenient method
|
||||
foreach ($result as $v) {
|
||||
$count[$v['status']] = $v['count'];
|
||||
}
|
||||
|
||||
d_echo("Component Count by Status: ".print_r($count,TRUE)."\n");
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function getComponentStatusLog($component=null,$start=null,$end=null) {
|
||||
if ( ($component == null) || ($start == null) || ($end == null) ) {
|
||||
// Error...
|
||||
d_echo("Required arguments are missing. Component: ".$component.", Start: ".$start.", End: ".$end."\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create our return array.
|
||||
$return = array();
|
||||
|
||||
// 1. find the previous value, this is the value when $start occurred.
|
||||
$sql_query = "SELECT status FROM component_statuslog WHERE `component` = ? AND time < ? ORDER BY `id` desc LIMIT 1";
|
||||
$sql_param = array($component,$start);
|
||||
$result = dbFetchRow($sql_query, $sql_param);
|
||||
if ($result == false) {
|
||||
$return['initial'] = false;
|
||||
}
|
||||
else {
|
||||
$return['initial'] = $result['status'];
|
||||
}
|
||||
|
||||
// 2. Then we just need a list of all the entries for the time period.
|
||||
$sql_query = "SELECT status, time, message FROM component_statuslog WHERE `component` = ? AND time >= ? AND time < ? ORDER BY `time`";
|
||||
$sql_param = array($component,$start,$end);
|
||||
$return['data'] = dbFetchRows($sql_query, $sql_param);
|
||||
|
||||
d_echo("Status Log Data: ".print_r($return,TRUE)."\n");
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function createComponent ($device_id,$TYPE) {
|
||||
// Prepare our default values to be inserted.
|
||||
$DATA = $this->reserved;
|
||||
@@ -159,6 +222,9 @@ class component {
|
||||
// Insert a new component into the database.
|
||||
$id = dbInsert($DATA, 'component');
|
||||
|
||||
// Add a default status log entry - we always start ok.
|
||||
$this->createStatusLogEntry($id,0,'Component Created');
|
||||
|
||||
// Create a default component array based on what was inserted.
|
||||
$ARRAY = array();
|
||||
$ARRAY[$id] = $DATA;
|
||||
@@ -166,6 +232,17 @@ class component {
|
||||
return $ARRAY;
|
||||
}
|
||||
|
||||
public function createStatusLogEntry($component,$status,$message) {
|
||||
// Add an entry to the statuslog table for a particular component.
|
||||
$DATA = array(
|
||||
'component' => $component,
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
);
|
||||
|
||||
return dbInsert($DATA, 'component_statuslog');
|
||||
}
|
||||
|
||||
public function deleteComponent ($id) {
|
||||
// Delete a component from the database.
|
||||
return dbDelete('component', "`id` = ?",array($id));
|
||||
@@ -187,6 +264,12 @@ class component {
|
||||
// Ignore type, we cant change that.
|
||||
unset($AVP['type'],$OLD[$device_id][$COMPONENT]['type']);
|
||||
|
||||
// If the Status has changed we need to add a log entry
|
||||
if ($AVP['status'] != $OLD[$device_id][$COMPONENT]['status']) {
|
||||
d_echo("Status Changed - Old: ".$OLD[$device_id][$COMPONENT]['status'].", New: ".$AVP['status']."\n");
|
||||
$this->createStatusLogEntry($COMPONENT,$AVP['status'],$AVP['error']);
|
||||
}
|
||||
|
||||
// Process our reserved components first.
|
||||
$UPDATE = array();
|
||||
foreach ($this->reserved as $k => $v) {
|
||||
@@ -239,7 +322,7 @@ class component {
|
||||
log_event("Component: ".$AVP[$COMPONENT]['type']."(".$COMPONENT."). Attribute: ".$ATTR.", was modified from: ".$OLD[$COMPONENT][$ATTR].", to: ".$VALUE,$device_id,'component',$COMPONENT);
|
||||
}
|
||||
|
||||
} // End Foreach COMPONENT
|
||||
} // End Foreach AVP
|
||||
|
||||
// Process our Deletes.
|
||||
$DELETE = array_diff_key($OLD[$device_id][$COMPONENT], $AVP);
|
||||
|
@@ -128,6 +128,30 @@ $config['os'][$os]['over'][1]['text'] = 'Processor Usage';
|
||||
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
|
||||
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
|
||||
|
||||
$os = 'gaia';
|
||||
$config['os'][$os]['text'] = 'Check Point GAiA';
|
||||
$config['os'][$os]['type'] = 'firewall';
|
||||
$config['os'][$os]['icon'] = 'checkpoint';
|
||||
$config['os'][$os]['ifname'] = 1;
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
|
||||
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
|
||||
$config['os'][$os]['over'][1]['text'] = 'Processor Usage';
|
||||
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
|
||||
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
|
||||
|
||||
$os = 'mypoweros';
|
||||
$config['os'][$os]['text'] = 'Maipu MyPower';
|
||||
$config['os'][$os]['type'] = 'network';
|
||||
$config['os'][$os]['icon'] = 'maipu';
|
||||
$config['os'][$os]['ifname'] = 1;
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
|
||||
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
|
||||
$config['os'][$os]['over'][1]['text'] = 'Processor Usage';
|
||||
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
|
||||
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
|
||||
|
||||
// Time server
|
||||
$os = 'microsemitime';
|
||||
$config['os'][$os]['text'] = 'Microsemi Timing';
|
||||
@@ -550,6 +574,30 @@ $config['os'][$os]['over'][4]['graph'] = 'device_ciscowlc_numclients';
|
||||
$config['os'][$os]['over'][4]['text'] = 'Number of Clients';
|
||||
$config['os'][$os]['icon'] = 'cisco';
|
||||
|
||||
$os = 'waas';
|
||||
$config['os'][$os]['group'] = 'cisco';
|
||||
$config['os'][$os]['text'] = 'Cisco WAAS';
|
||||
$config['os'][$os]['type'] = 'network';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
|
||||
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
|
||||
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
|
||||
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
|
||||
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
|
||||
$config['os'][$os]['icon'] = 'cisco';
|
||||
|
||||
$os = 'fxos';
|
||||
$config['os'][$os]['group'] = 'cisco';
|
||||
$config['os'][$os]['text'] = 'Cisco FX-OS';
|
||||
$config['os'][$os]['type'] = 'network';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
|
||||
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
|
||||
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
|
||||
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
|
||||
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
|
||||
$config['os'][$os]['icon'] = 'cisco';
|
||||
|
||||
// Brocade NOS
|
||||
$os = 'nos';
|
||||
$config['os'][$os]['text'] = 'Brocade NOS';
|
||||
@@ -976,6 +1024,10 @@ $config['os'][$os]['type'] = 'network';
|
||||
$config['os'][$os]['icon'] = 'dell';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Traffic';
|
||||
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
|
||||
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
|
||||
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
|
||||
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
|
||||
|
||||
$os = 'radlan';
|
||||
$config['os'][$os]['text'] = 'Radlan';
|
||||
@@ -1021,7 +1073,7 @@ $config['os'][$os]['over'][3]['text'] = 'Storage Usage';
|
||||
|
||||
// EMC FlareOS
|
||||
$os = 'flareos';
|
||||
$config['os'][$os]['text'] = 'EMC CLARiiON';
|
||||
$config['os'][$os]['text'] = 'EMC Flare OS';
|
||||
$config['os'][$os]['type'] = 'storage';
|
||||
$config['os'][$os]['icon'] = 'emc';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
@@ -1035,6 +1087,7 @@ $config['os'][$os]['over'][3]['text'] = 'Storage Usage';
|
||||
|
||||
$os = 'equallogic';
|
||||
$config['os'][$os]['text'] = 'Dell EqualLogic';
|
||||
$config['os'][$os]['type'] = 'storage';
|
||||
$config['os'][$os]['icon'] = 'dell';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
|
||||
|
@@ -116,11 +116,11 @@ if ($device['os_group'] == 'cisco') {
|
||||
// If we have set a message, we have an error, activate alert.
|
||||
if ($message !== false) {
|
||||
$result['error'] = $message;
|
||||
$result['status'] = 0;
|
||||
$result['status'] = 2;
|
||||
}
|
||||
else {
|
||||
$result['error'] = "";
|
||||
$result['status'] = 1;
|
||||
$result['status'] = 0;
|
||||
}
|
||||
|
||||
// Let's log some debugging
|
||||
@@ -154,11 +154,11 @@ if ($device['os_group'] == 'cisco') {
|
||||
// If we have set a message, we have an error, activate alert.
|
||||
if ($message !== false) {
|
||||
$result['error'] = $message;
|
||||
$result['status'] = 0;
|
||||
$result['status'] = 1;
|
||||
}
|
||||
else {
|
||||
$result['error'] = "";
|
||||
$result['status'] = 1;
|
||||
$result['status'] = 0;
|
||||
}
|
||||
|
||||
// Set a default name, if for some unknown reason we cant find the parent VPN.
|
||||
|
@@ -53,8 +53,9 @@ function discover_new_device($hostname, $device = '', $method = '', $interface =
|
||||
}
|
||||
|
||||
if (match_network($config['nets'], $ip)) {
|
||||
$remote_device_id = addHost($dst_host, '', '161', 'udp', '0', $config['distributed_poller_group']);
|
||||
if ($remote_device_id) {
|
||||
$result = addHost($dst_host, '', '161', 'udp', '0', $config['distributed_poller_group']);
|
||||
if (is_numeric($result)) {
|
||||
$remote_device_id = $result;
|
||||
$remote_device = device_by_id_cache($remote_device_id, 1);
|
||||
echo '+[' . $remote_device['hostname'] . '(' . $remote_device['device_id'] . ')]';
|
||||
discover_device($remote_device);
|
||||
@@ -72,9 +73,10 @@ function discover_new_device($hostname, $device = '', $method = '', $interface =
|
||||
}
|
||||
|
||||
return $remote_device_id;
|
||||
}
|
||||
else {
|
||||
log_event("$method discovery of " . $dst_host . " ($ip) failed - Check ping and SNMP access", $device['device_id'], 'discovery');
|
||||
} else {
|
||||
if(substr($result, 0, 12) !== 'Already have') {
|
||||
log_event("$method discovery of " . $dst_host . " ($ip) failed - " . $result);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
d_echo("$ip not in a matched network - skipping\n");
|
||||
@@ -89,6 +91,7 @@ function discover_device($device, $options = null) {
|
||||
$valid = array();
|
||||
// Reset $valid array
|
||||
$attribs = get_dev_attribs($device['device_id']);
|
||||
$device['snmp_max_repeaters'] = $attribs['snmp_max_repeaters'];
|
||||
|
||||
$device_start = microtime(true);
|
||||
// Start counting device poll time
|
||||
|
16
includes/discovery/os/checkpoint.inc.php
Normal file
16
includes/discovery/os/checkpoint.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
if (!$os) {
|
||||
if (strpos($sysObjectId, '.1.3.6.1.4.1.2620.1.6.123.1.49') !== false) {
|
||||
$os = 'gaia';
|
||||
}
|
||||
}
|
@@ -25,6 +25,10 @@ if (!$os) {
|
||||
//Dell N4064F
|
||||
$os = 'dnos';
|
||||
}
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.674.10895.3057')) {
|
||||
//Dell N3024
|
||||
$os = 'dnos';
|
||||
}
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.674.10895.3058')) {
|
||||
//Dell N3048P
|
||||
$os = 'dnos';
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if (!$os) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.1.1.1') || strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.1.1.43')) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.1.1.1') || strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.1.1.43') || strstr($sysObjectId, '.1.3.6.1.4.1.1588.2.1.1.72')) {
|
||||
$os = 'fabos';
|
||||
}
|
||||
}
|
||||
|
17
includes/discovery/os/fxos.inc.php
Normal file
17
includes/discovery/os/fxos.inc.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if (empty($os)) {
|
||||
if (strstr($sysDescr, 'Cisco FX-OS')) {
|
||||
$os = 'fxos';
|
||||
}
|
||||
}
|
@@ -3,5 +3,7 @@
|
||||
if (!$os) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.2636')) {
|
||||
$os = 'junos';
|
||||
} elseif (stristr($sysDescr, 'kernel JUNOS')) {
|
||||
$os = 'junos';
|
||||
}
|
||||
}
|
||||
|
16
includes/discovery/os/maipu.inc.php
Normal file
16
includes/discovery/os/maipu.inc.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
if (!$os) {
|
||||
if (strpos($sysObjectId, '.1.3.6.1.4.1.5651.1.102.21') !== false) {
|
||||
$os = 'mypoweros';
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if (!$os) {
|
||||
if (strstr($sysDescr, "Brocade VDX")) {
|
||||
if (strstr($sysDescr, "Brocade VDX")||strstr($sysDescr, "BR-VDX")||strstr($sysDescr, "VDX67")) {
|
||||
$os = "nos";
|
||||
}
|
||||
}
|
||||
|
17
includes/discovery/os/waas.inc.php
Normal file
17
includes/discovery/os/waas.inc.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if (!$os) {
|
||||
if (preg_match('/^Cisco\ Wide\ Area\ Application\ Services/', $sysDescr)) {
|
||||
$os = 'waas';
|
||||
}
|
||||
}
|
@@ -1,21 +1,18 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == 'powerconnect') {
|
||||
$sysObjectId = snmp_get($device, 'SNMPv2-MIB::sysObjectID.0', '-Ovqn');
|
||||
switch ($sysObjectId) {
|
||||
case '.1.3.6.1.4.1.674.10895.3031':
|
||||
/*
|
||||
* Devices supported:
|
||||
* Dell Powerconnect 55xx
|
||||
*/
|
||||
if (strpos($device["sysObjectID"], "enterprises.674.10895.3031") !== false) {
|
||||
d_echo("Dell Powerconnect 55xx");
|
||||
$usage = trim(snmp_get($device, '.1.3.6.1.4.1.89.1.7.0', '-Ovq'));
|
||||
discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.89.1.7.0', '0', 'powerconnect', 'Processor', '1', $usage, null, null);
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* Defaul Discovery for powerconnect series
|
||||
* Dell-Vendor-MIB::dellLanExtension.6132.1.1.1.1.4.4.0 = STRING: "5 Sec (6.99%), 1 Min (6.72%), 5 Min (9.06%)"
|
||||
*/
|
||||
} elseif (strpos($device["sysObjectID"], "enterprises.674.10895.3024") !== false) {
|
||||
d_echo("Dell Powerconnect 8024F");
|
||||
$usage = trim(snmp_get($device,'.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0', '-Ovq'), '"');
|
||||
$usage = ltrim($usage,' ');
|
||||
if (substr($usage, 0, 5) == '5 Sec') {
|
||||
discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0', '0', 'powerconnect', 'Processor', '1', $usage, null, null);
|
||||
}
|
||||
} else {
|
||||
$descr = 'Processor';
|
||||
$usage = trim(snmp_get($device, 'dellLanExtension.6132.1.1.1.1.4.4.0', '-OQUvs', 'Dell-Vendor-MIB'), '"');
|
||||
if (substr($usage, 0, 5) == '5 Sec') {
|
||||
|
39
includes/discovery/sensors/current/comware.inc.php
Normal file
39
includes/discovery/sensors/current/comware.inc.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'comware') {
|
||||
echo 'Comware ';
|
||||
|
||||
$multiplier = 1;
|
||||
$divisor = 100000;
|
||||
$divisor_alarm = 1000000;
|
||||
foreach ($comware_oids as $index => $entry) {
|
||||
if (is_numeric($entry['hh3cTransceiverBiasCurrent']) && $entry['hh3cTransceiverBiasCurrent'] != 2147483647) {
|
||||
$oid = '.1.3.6.1.4.1.25506.2.70.1.1.1.17.' . $index;
|
||||
$dbquery = dbFetchRows("SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", array(
|
||||
$index,
|
||||
$device['device_id']
|
||||
));
|
||||
$limit_low = $entry['hh3cTransceiverBiasLoAlarm'] / $divisor_alarm;
|
||||
$warn_limit_low = $entry['hh3cTransceiverBiasLoWarn'] / $divisor_alarm;
|
||||
$limit = $entry['hh3cTransceiverBiasHiAlarm'] / $divisor_alarm;
|
||||
$warn_limit = $entry['hh3cTransceiverBiasHiWarn'] / $divisor_alarm;
|
||||
$current = $entry['hh3cTransceiverBiasCurrent'] / $divisor;
|
||||
$entPhysicalIndex = $index;
|
||||
$entPhysicalIndex_measured = 'ports';
|
||||
foreach ($dbquery as $dbindex => $dbresult) {
|
||||
$descr = $dbresult['ifDescr'] . ' Bias Current';
|
||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 'bias-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
63
includes/discovery/sensors/dbm/comware.inc.php
Normal file
63
includes/discovery/sensors/dbm/comware.inc.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'comware') {
|
||||
echo 'Comware ';
|
||||
|
||||
// Based on 10G_BASE_LR_SFP, as HP does not provide threshold values through snmp
|
||||
// Alarm thresholds:
|
||||
// RX power(dBm) TX power(dBm)
|
||||
// 2.50 3.50
|
||||
// -12.30 -11.20
|
||||
|
||||
$multiplier = 1;
|
||||
$divisor = 100;
|
||||
foreach ($comware_oids as $index => $entry) {
|
||||
if (is_numeric($entry['hh3cTransceiverCurRXPower']) && $entry['hh3cTransceiverCurRXPower'] != 2147483647) {
|
||||
$oid = '.1.3.6.1.4.1.25506.2.70.1.1.1.12.' . $index;
|
||||
$dbquery = dbFetchRows("SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", array(
|
||||
$index,
|
||||
$device['device_id']
|
||||
));
|
||||
$limit_low = -30;
|
||||
$warn_limit_low = -12.3;
|
||||
$limit = 2.5;
|
||||
$warn_limit = -3;
|
||||
$current = $entry['hh3cTransceiverCurRXPower'] / $divisor;
|
||||
$entPhysicalIndex = $index;
|
||||
$entPhysicalIndex_measured = 'ports';
|
||||
foreach ($dbquery as $dbindex => $dbresult) {
|
||||
$descr = $dbresult['ifDescr'] . ' Rx Power';
|
||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_numeric($entry['hh3cTransceiverCurTXPower']) && $entry['hh3cTransceiverCurTXPower'] != 2147483647) {
|
||||
$oid = '.1.3.6.1.4.1.25506.2.70.1.1.1.9.' . $index;
|
||||
$dbquery = dbFetchRows("SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", array(
|
||||
$index,
|
||||
$device['device_id']
|
||||
));
|
||||
$limit_low = -30;
|
||||
$warn_limit_low = -11.2;
|
||||
$limit = 3.5;
|
||||
$warn_limit = -3;
|
||||
$current = $entry['hh3cTransceiverCurTXPower'] / $divisor;
|
||||
$entPhysicalIndex = $index;
|
||||
$entPhysicalIndex_measured = 'ports';
|
||||
foreach ($dbquery as $dbindex => $dbresult) {
|
||||
$descr = $dbresult['ifDescr'] . ' Tx Power';
|
||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
23
includes/discovery/sensors/pre-cache/comware.inc.php
Normal file
23
includes/discovery/sensors/pre-cache/comware.inc.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'comware') {
|
||||
|
||||
echo 'Pre-cache Comware: ';
|
||||
|
||||
$comware_oids = array();
|
||||
echo 'Caching OIDs:';
|
||||
|
||||
$comware_oids = snmpwalk_cache_multi_oid($device, 'hh3cTransceiverInfoTable', array(), 'HH3C-TRANSCEIVER-INFO-MIB');
|
||||
|
||||
}
|
||||
|
@@ -17,6 +17,6 @@ if ($device['os'] == 'junos') {
|
||||
$junos_oids = array();
|
||||
echo 'Caching OIDs:';
|
||||
|
||||
$junos_oids = snmpwalk_cache_multi_oid($device, 'JnxDomCurrentEntry', $oids, 'JUNIPER-DOM-MIB', $config['mib_dir'].':'.$config['mib_dir'].'/junos');
|
||||
$junos_oids = snmpwalk_cache_multi_oid($device, 'JnxDomCurrentEntry', array(), 'JUNIPER-DOM-MIB', $config['mib_dir'].':'.$config['mib_dir'].'/junos');
|
||||
|
||||
}
|
||||
|
@@ -16,6 +16,6 @@ if ($device['os'] == 'pbn') {
|
||||
$pbn_oids = array();
|
||||
echo 'Caching OIDs:';
|
||||
|
||||
$pbn_oids = snmpwalk_cache_multi_oid($device, 'ifSfpParameterTable', $oids, 'NMS-IF-MIB', $config['mib_dir'].':'.$config['mib_dir'].'/pbn');
|
||||
$pbn_oids = snmpwalk_cache_multi_oid($device, 'ifSfpParameterTable', array(), 'NMS-IF-MIB', $config['mib_dir'].':'.$config['mib_dir'].'/pbn');
|
||||
|
||||
}
|
||||
|
@@ -13,14 +13,17 @@
|
||||
if ($device['os_group'] == 'cisco') {
|
||||
|
||||
$tables = array(
|
||||
array('ciscoEnvMonVoltageStatusTable','.1.3.6.1.4.1.9.9.13.1.2.1.7.','ciscoEnvMonVoltageState','ciscoEnvMonVoltageStatusDescr') ,
|
||||
array('ciscoEnvMonTemperatureStatusTable','.1.3.6.1.4.1.9.9.13.1.3.1.6.','ciscoEnvMonTemperatureState','ciscoEnvMonTemperatureStatusDescr') ,
|
||||
array('ciscoEnvMonFanStatusTable','.1.3.6.1.4.1.9.9.13.1.4.1.3.','ciscoEnvMonFanState','ciscoEnvMonFanStatusDescr') ,
|
||||
array('ciscoEnvMonSupplyStatusTable','.1.3.6.1.4.1.9.9.13.1.5.1.3.','ciscoEnvMonSupplyState','ciscoEnvMonSupplyStatusDescr')
|
||||
array('ciscoEnvMonVoltageStatusTable','.1.3.6.1.4.1.9.9.13.1.2.1.7.','ciscoEnvMonVoltageState','ciscoEnvMonVoltageStatusDescr', 'CISCO-ENVMON-MIB') ,
|
||||
array('ciscoEnvMonTemperatureStatusTable','.1.3.6.1.4.1.9.9.13.1.3.1.6.','ciscoEnvMonTemperatureState','ciscoEnvMonTemperatureStatusDescr', 'CISCO-ENVMON-MIB') ,
|
||||
array('ciscoEnvMonFanStatusTable','.1.3.6.1.4.1.9.9.13.1.4.1.3.','ciscoEnvMonFanState','ciscoEnvMonFanStatusDescr', 'CISCO-ENVMON-MIB') ,
|
||||
array('ciscoEnvMonSupplyStatusTable','.1.3.6.1.4.1.9.9.13.1.5.1.3.','ciscoEnvMonSupplyState','ciscoEnvMonSupplyStatusDescr', 'CISCO-ENVMON-MIB') ,
|
||||
array('cRFCfgRedundancyOperMode','.1.3.6.1.4.1.9.9.176.1.2.14.','cRFCfgRedundancyOperMode','VSS Mode', 'CISCO-RF-MIB') ,
|
||||
array('cRFStatusUnitState','.1.3.6.1.4.1.9.9.176.1.1.2.','cRFStatusUnitState','VSS Device State', 'CISCO-RF-MIB') ,
|
||||
array('cRFStatusPeerUnitState','.1.3.6.1.4.1.9.9.176.1.1.4.','cRFStatusPeerUnitState','VSS Peer State', 'CISCO-RF-MIB')
|
||||
);
|
||||
|
||||
foreach($tables as $tablevalue){
|
||||
$temp = snmpwalk_cache_multi_oid($device, $tablevalue[0], array(), 'CISCO-ENVMON-MIB');
|
||||
$temp = snmpwalk_cache_multi_oid($device, $tablevalue[0], array(), $tablevalue[4]);
|
||||
$cur_oid = $tablevalue[1];
|
||||
|
||||
if (is_array($temp)) {
|
||||
@@ -30,14 +33,48 @@ if ($device['os_group'] == 'cisco') {
|
||||
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = array(
|
||||
array($state_index_id,'normal',0,1,0) ,
|
||||
array($state_index_id,'warning',0,2,1) ,
|
||||
array($state_index_id,'critical',0,3,2) ,
|
||||
array($state_index_id,'shutdown',0,4,3) ,
|
||||
array($state_index_id,'notPresent',0,5,3) ,
|
||||
array($state_index_id,'notFunctioning',0,6,2)
|
||||
);
|
||||
if ($state_name == 'cRFStatusUnitState' || $state_name == 'cRFStatusPeerUnitState') {
|
||||
$states = array(
|
||||
array($state_index_id,'notKnown',0,1,1) ,
|
||||
array($state_index_id,'disabled',0,2,0) ,
|
||||
array($state_index_id,'initialization',0,3,1) ,
|
||||
array($state_index_id,'negotiation',0,4,1) ,
|
||||
array($state_index_id,'standbyCold',0,5,1) ,
|
||||
array($state_index_id,'standbyColdConfig',0,6,1) ,
|
||||
array($state_index_id,'standbyColdFileSys',0,7,1) ,
|
||||
array($state_index_id,'standbyColdBulk',0,8,1) ,
|
||||
array($state_index_id,'standbyHot',0,9,0) ,
|
||||
array($state_index_id,'activeFast',0,10,1) ,
|
||||
array($state_index_id,'activeDrain',0,11,1) ,
|
||||
array($state_index_id,'activePreconfig',0,12,1) ,
|
||||
array($state_index_id,'activePostconfig',0,13,1) ,
|
||||
array($state_index_id,'active',0,14,0) ,
|
||||
array($state_index_id,'activeExtraload',0,15,1) ,
|
||||
array($state_index_id,'activeHandback',0,16,1)
|
||||
);
|
||||
|
||||
} elseif ($state_name == 'cRFCfgRedundancyOperMode') {
|
||||
$states = array(
|
||||
array($state_index_id,'nonRedundant',0,1,0) ,
|
||||
array($state_index_id,'staticLoadShareNonRedundant',0,2,0) ,
|
||||
array($state_index_id,'dynamicLoadShareNonRedundant',0,3,0) ,
|
||||
array($state_index_id,'staticLoadShareRedundant',0,4,0) ,
|
||||
array($state_index_id,'dynamicLoadShareRedundant',0,5,0) ,
|
||||
array($state_index_id,'coldStandbyRedundant',0,6,0) ,
|
||||
array($state_index_id,'warmStandbyRedundant',0,7,0) ,
|
||||
array($state_index_id,'hotStandbyRedundant',0,8,0)
|
||||
);
|
||||
} else {
|
||||
$states = array(
|
||||
array($state_index_id,'normal',0,1,0) ,
|
||||
array($state_index_id,'warning',0,2,1) ,
|
||||
array($state_index_id,'critical',0,3,2) ,
|
||||
array($state_index_id,'shutdown',0,4,3) ,
|
||||
array($state_index_id,'notPresent',0,5,3) ,
|
||||
array($state_index_id,'notFunctioning',0,6,2)
|
||||
);
|
||||
}
|
||||
|
||||
foreach($states as $value){
|
||||
$insert = array(
|
||||
'state_index_id' => $value[0],
|
||||
@@ -53,6 +90,9 @@ if ($device['os_group'] == 'cisco') {
|
||||
foreach ($temp as $index => $entry) {
|
||||
//Discover Sensors
|
||||
$descr = ucwords($temp[$index][$tablevalue[3]]);
|
||||
if ($state_name == 'cRFStatusUnitState' || $state_name == 'cRFStatusPeerUnitState' || $state_name == 'cRFCfgRedundancyOperMode') {
|
||||
$descr = $tablevalue[3];
|
||||
}
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid.$index, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp[$index][$tablevalue[2]], 'snmp', $index);
|
||||
|
||||
//Create Sensor To State Index
|
||||
|
63
includes/discovery/sensors/states/comware.inc.php
Normal file
63
includes/discovery/sensors/states/comware.inc.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'comware') {
|
||||
|
||||
$tables = array(
|
||||
array('hh3cdevMFanStatusTable','.1.3.6.1.4.1.25506.8.35.9.1.1.1.2.','hh3cDevMFanStatus') ,
|
||||
array('hh3cdevMPowerStatusTable','.1.3.6.1.4.1.25506.8.35.9.1.2.1.2.','hh3cDevMPowerStatus')
|
||||
);
|
||||
|
||||
foreach($tables as $tablevalue){
|
||||
$temp = snmpwalk_cache_multi_oid($device, $tablevalue[0], array(), 'HH3C-LswDEVM-MIB');
|
||||
$cur_oid = $tablevalue[1];
|
||||
|
||||
if (is_array($temp)) {
|
||||
//Create State Index
|
||||
$state_name = $tablevalue[2];
|
||||
$state_index_id = create_state_index($state_name);
|
||||
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = array(
|
||||
array($state_index_id,'active',0,1,0) ,
|
||||
array($state_index_id,'deactive',0,2,2) ,
|
||||
array($state_index_id,'not-install',0,3,3) ,
|
||||
array($state_index_id,'unsupport',0,4,1)
|
||||
);
|
||||
foreach($states as $value){
|
||||
$insert = array(
|
||||
'state_index_id' => $value[0],
|
||||
'state_descr' => $value[1],
|
||||
'state_draw_graph' => $value[2],
|
||||
'state_value' => $value[3],
|
||||
'state_generic_value' => $value[4]
|
||||
);
|
||||
dbInsert($insert, 'state_translations');
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($temp as $index => $entry) {
|
||||
//Discover Sensors
|
||||
$descr = 'Fan ' . $index;
|
||||
if ($entry['hh3cDevMPowerStatus']) {
|
||||
$descr = 'Power Supply ' . $index;
|
||||
}
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid.$index, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp[$index][$tablevalue[2]], 'snmp', $index);
|
||||
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user