diff --git a/.gitignore b/.gitignore index fe34379a88..8025a1d7e0 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ # Others # ########## *.swp +/composer.lock Thumbs.db config.php html/plugins/* @@ -20,4 +21,4 @@ logs nbproject patches rrd - +/vendor diff --git a/.scrutinizer.yml b/.scrutinizer.yml index c924a41d1c..e2ae05a96c 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -5,4 +5,4 @@ imports: # FIXME: find a way to keep excluded_paths list sorted filter: - excluded_paths: [ html/includes/geshi/*, html/includes/jpgraph/*, html/js/*, includes/phpmailer/*, html/css/*, html/includes/Slim/*, includes/console_colour.php, includes/console_table.php, html/lib/*, lib/* ] + excluded_paths: [ html/js/*, includes/phpmailer/*, html/css/*, includes/console_colour.php, includes/console_table.php, html/lib/*, lib/* ] diff --git a/.travis.yml b/.travis.yml index a3ea97cf9e..d1746dfa3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,18 +2,32 @@ language: php matrix: fast_finish: true include: - - php: 5.3 - script: find . -path './lib/influxdb-php' -prune -o -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 - - php: 5.4 - script: find . -path './lib/influxdb-php' -prune -o -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 - - php: 5.5 - script: find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 - - php: 5.6 - script: find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 - php: 7.0 - script: find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 + env: PHP_L=1 + - php: 5.3 + env: PHP_L_OLD=1 + - php: 5.4 + env: PHP_L_OLD=1 + - php: 5.5 + env: PHP_L=1 + - php: 5.6 + env: PHP_L=1 PHPCS=0 - php: hhvm - script: find . -path './lib/influxdb-php' -prune -o -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 + env: PHP_L_OLD=1 + allow_failures: - php: 7.0 - php: hhvm + +cache: + directories: + - vendor + - $HOME/.composer/cache + +before_script: + - composer install --prefer-dist --no-interaction + +script: + - if [[ $PHP_L == 1 ]]; then find . -path './vendor' -prune -o -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1; fi + - if [[ $PHP_L_OLD == 1 ]]; then find . -regextype posix-extended -regex "\./(lib/influxdb-php|vendor)" -prune -o -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1; fi + - if [[ $PHP_CS == 1 ]]; then vendor/bin/phpcs -n -p --colors --extensions=php --standard=PSR2 --ignore=html/lib/* .; fi diff --git a/AUTHORS.md b/AUTHORS.md index 87d40e61b5..e1a211348f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -116,6 +116,8 @@ LibreNMS contributors: - Karsten Schmidt (guggemand) - Maxence POULAIN (Linutux42) - Florian Beer (florianbeer) +- Vladislav Solovei (vladsol) +- Daniel van Dorp (djvdorp) [1]: http://observium.org/ "Observium web site" Observium was written by: diff --git a/adduser.php b/adduser.php index f1e591415c..d46119e770 100755 --- a/adduser.php +++ b/adduser.php @@ -19,7 +19,7 @@ require 'includes/defaults.inc.php'; require 'config.php'; require 'includes/definitions.inc.php'; require 'includes/functions.php'; -require 'html/includes/PasswordHash.php'; +require 'html/lib/PasswordHash.php'; if (file_exists('html/includes/authentication/'.$config['auth_mechanism'].'.inc.php')) { include 'html/includes/authentication/'.$config['auth_mechanism'].'.inc.php'; diff --git a/composer.json b/composer.json new file mode 100644 index 0000000000..2dd4acf45c --- /dev/null +++ b/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "squizlabs/php_codesniffer": "*" + } +} diff --git a/doc/Extensions/Applications.md b/doc/Extensions/Applications.md index 4c0539d86b..910194430c 100644 --- a/doc/Extensions/Applications.md +++ b/doc/Extensions/Applications.md @@ -13,6 +13,8 @@ Different applications support a variety of ways collect data: by direct connect 7. [OS Updates](#os-updates) - extend SNMP 8. [DHCP Stats](#dhcp-stats) - extend SNMP 9. [Memcached](#memcached) - extend SNMP +10. [Unbound](#unbound) - Agent +11. [Proxmox](#proxmos) - extend SNMP * [Agent Setup](#agent-setup) @@ -168,6 +170,33 @@ 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. +### Unbound + +##### Agent +[Install the agent](#agent-setup) on this device if it isn't already and copy the `unbound.sh` script to `/usr/lib/check_mk_agent/local/` + +Unbound configuration: + +```text +# Enable extended statistics. +server: + statistics-interval: 0 + extended-statistics: yes + statistics-cumulative: yes +``` + +Restart your unbound after changing the configuration,v erify it is working by running /usr/lib/check_mk_agent/local/unbound.sh + +### Proxmox +1. Download the script onto the desired host (the host must be added to LibreNMS devices) +`wget https://github.com/librenms/librenms-agent/blob/master/agent-local/proxmox -o /usr/local/bin/proxmox` +2. Make the script executable: `chmod +x /usr/local/proxmox` +3. Edit your snmpd.conf file (usually `/etc/snmp/snmpd.conf`) and add: +`extend proxmox /usr/local/bin/proxmox` +(Note: if your snmpd doesn't run as root, you might have to invoke the script using sudo. `extend proxmox /usr/bin/sudo /usr/local/bin/proxmox`) +4. Restart snmpd on your host +5. On the device page in Librenms, edit your host and check `Proxmox` on the Applications tab. + Agent Setup ----------- diff --git a/doc/Installation/Installation-CentOS-7-Apache.md b/doc/Installation/Installation-CentOS-7-Apache.md index 9b08cd898f..343ed839d6 100644 --- a/doc/Installation/Installation-CentOS-7-Apache.md +++ b/doc/Installation/Installation-CentOS-7-Apache.md @@ -126,7 +126,11 @@ vim /etc/snmpd/snmpd.conf Edit the text which says `RANDOMSTRINGGOESHERE` and set your own community string. -`service snmpd restart` +```bash +curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro +chmod +x /usr/bin/distro +service snmpd restart +``` #### Cron job diff --git a/doc/Installation/Installation-CentOS-7-Nginx.md b/doc/Installation/Installation-CentOS-7-Nginx.md index ebf4cf1e62..2554e84d76 100644 --- a/doc/Installation/Installation-CentOS-7-Nginx.md +++ b/doc/Installation/Installation-CentOS-7-Nginx.md @@ -137,7 +137,11 @@ vim /etc/snmpd/snmpd.conf Edit the text which says `RANDOMSTRINGGOESHERE` and set your own community string. -`service snmpd restart` +```bash +curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro +chmod +x /usr/bin/distro +service snmpd restart +``` #### Cron job diff --git a/doc/Installation/Installation-Nginx-(Debian-Ubuntu).md b/doc/Installation/Installation-Nginx-(Debian-Ubuntu).md index 957d0a9706..d44288b29e 100644 --- a/doc/Installation/Installation-Nginx-(Debian-Ubuntu).md +++ b/doc/Installation/Installation-Nginx-(Debian-Ubuntu).md @@ -151,7 +151,7 @@ On at least Ubuntu 14.04 (and possibly other distributions and versions as well) Restart nginx: service nginx restart - + Restart php5-fpm: service php5-fpm restart diff --git a/doc/Installation/Installation-Ubuntu-1604-Apache.md b/doc/Installation/Installation-Ubuntu-1604-Apache.md index 18e9962ce7..fd3e834290 100644 --- a/doc/Installation/Installation-Ubuntu-1604-Apache.md +++ b/doc/Installation/Installation-Ubuntu-1604-Apache.md @@ -110,7 +110,11 @@ vim /etc/snmpd.conf Edit the text which says `RANDOMSTRINGGOESHERE` and set your own community string. -`service snmpd restart` +```bash +curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro +chmod +x /usr/bin/distro +service snmpd restart +``` #### Cron job @@ -139,10 +143,10 @@ We now suggest that you add localhost as your first device from within the WebUI 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/] + - [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 diff --git a/doc/Installation/Installation-Ubuntu-1604-Nginx.md b/doc/Installation/Installation-Ubuntu-1604-Nginx.md index 95549343d5..93ae98c4c1 100644 --- a/doc/Installation/Installation-Ubuntu-1604-Nginx.md +++ b/doc/Installation/Installation-Ubuntu-1604-Nginx.md @@ -34,7 +34,7 @@ sql-mode="" ### Web Server ### -#### Install / Configure Nginx +#### Install / Configure Nginx `apt-get install php7.0-cli php7.0-mysql php7.0-gd php7.0-snmp php-pear php7.0-curl php7.0-fpm snmp graphviz php7.0-mcrypt php7.0-json nginx-full fping imagemagick whois mtr-tiny nmap python-mysqldb snmpd php-net-ipv4 php-net-ipv6 rrdtool git` @@ -113,7 +113,11 @@ vim /etc/snmpd.conf Edit the text which says `RANDOMSTRINGGOESHERE` and set your own community string. -`service snmpd restart` +```bash +curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro +chmod +x /usr/bin/distro +service snmpd restart +``` #### Cron job @@ -142,10 +146,10 @@ We now suggest that you add localhost as your first device from within the WebUI 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/] + - [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 diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index c44fc9e9cc..47aed8f5cb 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -190,6 +190,11 @@ $config['overview_show_sysDescr'] = TRUE; ``` Enable or disable the sysDescr output for a device. +```php +$config['force_ip_to_sysname'] = false; +``` +When using IP addresses as a hostname you can instead represent the devices on the WebUI by its SNMP sysName resulting in an easier to read overview of your network. This would apply on networks where you don't have DNS records for most of your devices. + ```php $config['device_traffic_iftype'][] = '/loopback/'; ``` diff --git a/html/ajax_mapview.php b/html/ajax_mapview.php new file mode 100644 index 0000000000..66c4cd34d4 --- /dev/null +++ b/html/ajax_mapview.php @@ -0,0 +1,7 @@ + * Copyright (c) 2016 Jens Langhammer + * Copyright (c) 2016 Cercel Valentin * 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 (defined('show_settings')) { $current_mode = isset($widget_settings['mode']) ? $widget_settings['mode'] : 0; $current_width = isset($widget_settings['tile_width']) ? $widget_settings['tile_width'] : 10; + $common_output[] = '
-
- -
- -
+
+ +
+
-
- -
- -
+
+
+ +
+
-
-
- -
-
- - '; -} -else { +
+
+
+
+ '; +} else { require_once 'includes/object-cache.inc.php'; - $mode = isset($widget_settings['mode']) ? $widget_settings['mode'] : 0; + $mode = isset($_SESSION["mapView"]) ? $_SESSION["mapView"] : 0; + + $widget_mode = isset($widget_settings['mode']) ? $widget_settings['mode'] : 0; $tile_width = isset($widget_settings['tile_width']) ? $widget_settings['tile_width'] : 10; - $up_count = 0; - $warn_count = 0; - $down_count = 0; + $host_up_count = 0; + $host_warn_count = 0; + $host_down_count = 0; + $service_up_count = 0; + $service_warn_count = 0; + $service_down_count = 0; if ($mode == 0 || $mode == 2) { // Only show devices if mode is 0 or 2 (Only Devices or both) - $sql = 'SELECT `D`.`hostname`,`D`.`device_id`,`D`.`status`,`D`.`uptime` FROM `devices` AS `D`'; + $sql = 'SELECT `D`.`hostname`,`D`.`device_id`,`D`.`status`,`D`.`uptime`, `D`.`os`, `D`.`icon` FROM `devices` AS `D`'; if (is_normal_user() === true) { $sql .= ' , `devices_perms` AS P WHERE D.`device_id` = P.`device_id` AND P.`user_id` = ? AND'; $param = array( $_SESSION['user_id'] - ); - } - else { + ); + } else { $sql .= ' WHERE'; } $sql .= " `D`.`ignore` = '0' AND `D`.`disabled` = '0' ORDER BY `hostname`"; @@ -67,49 +68,122 @@ else { foreach (dbFetchRows($sql, $param) as $device) { if ($device['status'] == '1') { if (($device['uptime'] < $config['uptime_warning']) && ($device['uptime'] != '0')) { - $btn_type = 'btn-warning'; - $warn_count++; + $deviceState = 'warn'; + $deviceLabel = 'label-warning'; + $host_warn_count++; + } else { + $deviceState = 'up'; + $deviceLabel = 'label-success'; + $host_up_count++; } - else { - $btn_type = 'btn-success'; - $up_count ++; - } - } - else { - $btn_type = 'btn-danger'; - $down_count++; + } else { + $deviceState = 'down'; + $deviceLabel = 'label-danger'; + $host_down_count++; + } + + if ($directpage == "yes") { + $deviceIcon = getImage($device); + $temp_output[] = ' + +
+ + '.$deviceIcon.'
+ '.$device["hostname"].' +
+
'; + } else { + $temp_output[] = ' + + + '; } - $temp_output[] = ''; } } if ($mode == 1 || $mode == 2) { - $service_query = 'select `S`.`service_type`, `S`.`service_id`, `S`.`service_desc`, `S`.`service_status`, `D`.`hostname`, `D`.`device_id` from services S, devices D where `S`.`device_id` = `D`.`device_id`;'; + $service_query = 'select `S`.`service_type`, `S`.`service_id`, `S`.`service_desc`, `S`.`service_status`, `D`.`hostname`, `D`.`device_id`, `D`.`os`, `D`.`icon` from services S, devices D where `S`.`device_id` = `D`.`device_id`;'; foreach (dbFetchRows($service_query) as $service) { if ($service['service_status'] == '0') { - $btn_type = 'btn-success'; - $up_count ++; - } - else { - $btn_type = 'btn-danger'; - $down_count += 1; + $serviceLabel = "label-success"; + $serviceState = "up"; + $service_up_count++; + } elseif ($service['service_status'] == '1') { + $serviceLabel = "label-warning"; + $serviceState = "warn"; + $service_warn_count++; + } else { + $serviceLabel = "label-danger"; + $serviceState = "down"; + $service_down_count++; } - $temp_output[] = ''; + if ($directpage == "yes") { + $deviceIcon = getImage($service); + $temp_output[] = ' + +
+ + + '.$deviceIcon.'
+ '.$service["hostname"].' +
+
'; + } else { + $temp_output[] = ' + + + '; + } } } - $temp_output[] = '
'; - $temp_header = array( - '
'.$up_count.' '.$warn_count.' '.$down_count.'

' - ); + if ($directpage == "yes") { + $temp_header[] = ' +
+ Availability map for + +
+
'; + } + + if ($mode == 0 || $mode == 2) { + if ($directpage == "yes") { + $headerClass = 'page-availability-report-host'; + } else { + $headerClass = 'widget-availability-host'; + } + $temp_header[] = ' +
+ Total hosts + + + +
'; + } + + if ($mode == 1 || $mode == 2) { + if ($directpage == "yes") { + $headerClass = 'page-availability-report-service'; + } else { + $headerClass = 'widget-availability-service'; + } + $temp_header[] = ' +
+ Total services + + + +
'; + } + + $temp_header[] = '
'; + $temp_header[] = '
'; + $common_output = array_merge($temp_header, $temp_output); -} +} \ No newline at end of file diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index f23a5538d1..19e396a7a8 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -1346,3 +1346,16 @@ function get_ports_from_type($given_types) { $ports = dbFetchRows("SELECT * FROM `ports` as I, `devices` AS D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias", $type_param); return $ports; } + +function ipmiSensorName($hardwareId, $sensorIpmi, $rewriteArray) +{ + if(count($rewriteArray[$hardwareId]) > 0) { + if($rewriteArray[$hardwareId][$sensorIpmi] != "") { + return $rewriteArray[$hardwareId][$sensorIpmi]; + } else { + return $sensorIpmi; + } + } else { + return $sensorIpmi; + } +} diff --git a/html/includes/graphs/application/proxmox_traffic.inc.php b/html/includes/graphs/application/proxmox_traffic.inc.php index ea7f75c63e..eb2055ac99 100644 --- a/html/includes/graphs/application/proxmox_traffic.inc.php +++ b/html/includes/graphs/application/proxmox_traffic.inc.php @@ -18,7 +18,7 @@ require 'includes/graphs/common.inc.php'; -$proxmox_rrd = $config['rrd_dir'].'/proxmox/'.$vars['cluster'].'/'.$vars['vmid'].'_netif_'.$vars['port'].'.rrd'; +$proxmox_rrd = proxmox_rrd_name($vars['cluster'], $vars['vmid'], $vars['port']); if (rrdtool_check_rrd_exists($proxmox_rrd)) { $rrd_filename = $proxmox_rrd; diff --git a/html/includes/graphs/application/shoutcast_multi_bits.inc.php b/html/includes/graphs/application/shoutcast_multi_bits.inc.php index cd193c6bf9..208c093df6 100644 --- a/html/includes/graphs/application/shoutcast_multi_bits.inc.php +++ b/html/includes/graphs/application/shoutcast_multi_bits.inc.php @@ -21,7 +21,7 @@ $colour_area_in = 'CDEB8B'; $colour_area_out = 'C3D9FF'; $rrd_list = array(); -$rrd_filenames = glob(rrd_name($device['hostname'], array('app', 'shoutcast', $app['app_id'], '*'))); +$rrd_filenames = glob(rrd_name($device['hostname'], array('app', 'shoutcast', $app['app_id']), '*.rrd')); foreach ($rrd_filenames as $file) { $pieces = explode('-', basename($file, '.rrd')); $hostname = end($pieces); diff --git a/html/includes/graphs/application/shoutcast_multi_stats.inc.php b/html/includes/graphs/application/shoutcast_multi_stats.inc.php index 3a72450623..f2239470eb 100644 --- a/html/includes/graphs/application/shoutcast_multi_stats.inc.php +++ b/html/includes/graphs/application/shoutcast_multi_stats.inc.php @@ -8,7 +8,7 @@ $total_text = 'Total of all ShoutCast Servers'; $nototal = 0; $rrd_list = array(); -$rrd_filenames = glob(rrd_name($device['hostname'], array('app', 'shoutcast', $app['app_id'], '*'))); +$rrd_filenames = glob(rrd_name($device['hostname'], array('app', 'shoutcast', $app['app_id']), '*.rrd')); foreach ($rrd_filenames as $file) { $pieces = explode('-', basename($file, '.rrd')); $hostname = end($pieces); diff --git a/html/includes/graphs/application/unbound_queries.inc.php b/html/includes/graphs/application/unbound_queries.inc.php new file mode 100644 index 0000000000..2733923b42 --- /dev/null +++ b/html/includes/graphs/application/unbound_queries.inc.php @@ -0,0 +1,47 @@ + + * + * 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. + */ + +require_once "../includes/component.php"; +$component = new component(); +$options = array(); +$options['filter']['type'] = array('=','ntp'); +$components = $component->getComponents($device['device_id'],$options); + +// We only care about our device id. +$components = $components[$device['device_id']]; + +include "includes/graphs/common.inc.php"; +$rrd_options .= " -l 0 -E "; +$rrd_options .= " COMMENT:'Delay Now Min Max\\n'"; +$rrd_additions = ""; + +$count = 0; +foreach ($components as $id => $array) { + $rrd_filename = rrd_name($device['hostname'], array('ntp', $array['peer'])); + + if (file_exists($rrd_filename)) { + // Grab a color from the array. + if ( isset($config['graph_colours']['mixed'][$count]) ) { + $color = $config['graph_colours']['mixed'][$count]; + } else { + $color = $config['graph_colours']['oranges'][$count-7]; + } + + $rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":delay:AVERAGE "; + $rrd_additions .= " LINE1.25:DS" . $count . "#" . $color . ":'" . str_pad(substr($array['peer'].' (s)',0,15),15) . "'" . $stack; + $rrd_additions .= " GPRINT:DS" . $count . ":LAST:%7.0lf "; + $rrd_additions .= " GPRINT:DS" . $count . ":MIN:%7.0lf "; + $rrd_additions .= " GPRINT:DS" . $count . ":MAX:%7.0lf\\\l "; + $count++; + } +} + +if ($rrd_additions == "") { + // We didn't add any data points. +} else { + $rrd_options .= $rrd_additions; +} diff --git a/html/includes/graphs/device/ntp_dispersion.inc.php b/html/includes/graphs/device/ntp_dispersion.inc.php new file mode 100644 index 0000000000..d88a00fb68 --- /dev/null +++ b/html/includes/graphs/device/ntp_dispersion.inc.php @@ -0,0 +1,53 @@ + + * + * 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. + */ + +require_once "../includes/component.php"; +$component = new component(); +$options = array(); +$options['filter']['type'] = array('=','ntp'); +$components = $component->getComponents($device['device_id'],$options); + +// We only care about our device id. +$components = $components[$device['device_id']]; + +include "includes/graphs/common.inc.php"; +$rrd_options .= " -l 0 -E "; +$rrd_options .= " COMMENT:'Dispersion Now Min Max\\n'"; +$rrd_additions = ""; + +$count = 0; +foreach ($components as $id => $array) { + $rrd_filename = rrd_name($device['hostname'], array('ntp', $array['peer'])); + + if (file_exists($rrd_filename)) { + // Grab a color from the array. + if ( isset($config['graph_colours']['mixed'][$count]) ) { + $color = $config['graph_colours']['mixed'][$count]; + } else { + $color = $config['graph_colours']['oranges'][$count-7]; + } + + $rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":dispersion:AVERAGE "; + $rrd_additions .= " LINE1.25:DS" . $count . "#" . $color . ":'" . str_pad(substr($array['peer'].' (s)',0,15),15) . "'" . $stack; + $rrd_additions .= " GPRINT:DS" . $count . ":LAST:%7.0lf "; + $rrd_additions .= " GPRINT:DS" . $count . ":MIN:%7.0lf "; + $rrd_additions .= " GPRINT:DS" . $count . ":MAX:%7.0lf\\\l "; + $count++; + } +} + +if ($rrd_additions == "") { + // We didn't add any data points. +} else { + $rrd_options .= $rrd_additions; +} diff --git a/html/includes/graphs/device/ntp_offset.inc.php b/html/includes/graphs/device/ntp_offset.inc.php new file mode 100644 index 0000000000..6e79b9f465 --- /dev/null +++ b/html/includes/graphs/device/ntp_offset.inc.php @@ -0,0 +1,53 @@ + + * + * 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. + */ + +require_once "../includes/component.php"; +$component = new component(); +$options = array(); +$options['filter']['type'] = array('=','ntp'); +$components = $component->getComponents($device['device_id'],$options); + +// We only care about our device id. +$components = $components[$device['device_id']]; + +include "includes/graphs/common.inc.php"; +$rrd_options .= " -l 0 -E "; +$rrd_options .= " COMMENT:'Offset Now Min Max\\n'"; +$rrd_additions = ""; + +$count = 0; +foreach ($components as $id => $array) { + $rrd_filename = rrd_name($device['hostname'], array('ntp', $array['peer'])); + + if (file_exists($rrd_filename)) { + // Grab a color from the array. + if ( isset($config['graph_colours']['mixed'][$count]) ) { + $color = $config['graph_colours']['mixed'][$count]; + } else { + $color = $config['graph_colours']['oranges'][$count-7]; + } + + $rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":offset:AVERAGE "; + $rrd_additions .= " LINE1.25:DS" . $count . "#" . $color . ":'" . str_pad(substr($array['peer'].' (s)',0,15),15) . "'" . $stack; + $rrd_additions .= " GPRINT:DS" . $count . ":LAST:%4.0lf "; + $rrd_additions .= " GPRINT:DS" . $count . ":MIN:%4.0lf "; + $rrd_additions .= " GPRINT:DS" . $count . ":MAX:%4.0lf\\\l "; + $count++; + } +} + +if ($rrd_additions == "") { + // We didn't add any data points. +} else { + $rrd_options .= $rrd_additions; +} diff --git a/html/includes/graphs/device/ntp_stratum.inc.php b/html/includes/graphs/device/ntp_stratum.inc.php new file mode 100644 index 0000000000..edd2a71d0c --- /dev/null +++ b/html/includes/graphs/device/ntp_stratum.inc.php @@ -0,0 +1,53 @@ + + * + * 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. + */ + +require_once "../includes/component.php"; +$component = new component(); +$options = array(); +$options['filter']['type'] = array('=','ntp'); +$components = $component->getComponents($device['device_id'],$options); + +// We only care about our device id. +$components = $components[$device['device_id']]; + +include "includes/graphs/common.inc.php"; +$rrd_options .= " -l 0 -E "; +$rrd_options .= " COMMENT:'Stratum Now Min Max\\n'"; +$rrd_additions = ""; + +$count = 0; +foreach ($components as $id => $array) { + $rrd_filename = rrd_name($device['hostname'], array('ntp', $array['peer'])); + + if (file_exists($rrd_filename)) { + // Grab a color from the array. + if ( isset($config['graph_colours']['mixed'][$count]) ) { + $color = $config['graph_colours']['mixed'][$count]; + } else { + $color = $config['graph_colours']['oranges'][$count-7]; + } + + $rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":stratum:AVERAGE "; + $rrd_additions .= " LINE1.25:DS" . $count . "#" . $color . ":'" . str_pad(substr($array['peer'],0,15),15) . "'" . $stack; + $rrd_additions .= " GPRINT:DS" . $count . ":LAST:%2.0lf "; + $rrd_additions .= " GPRINT:DS" . $count . ":MIN:%2.0lf "; + $rrd_additions .= " GPRINT:DS" . $count . ":MAX:%2.0lf\\\l "; + $count++; + } +} + +if ($rrd_additions == "") { + // We didn't add any data points. +} else { + $rrd_options .= $rrd_additions; +} diff --git a/html/includes/graphs/device/sla.inc.php b/html/includes/graphs/device/sla.inc.php index a6a1456be8..820ca7888c 100644 --- a/html/includes/graphs/device/sla.inc.php +++ b/html/includes/graphs/device/sla.inc.php @@ -2,35 +2,20 @@ require 'includes/graphs/common.inc.php'; -// FIXME - THIS IS BROKEN -$sla = dbFetchRow('SELECT * FROM `slas` WHERE `sla_id` = ?', array($vars['id'])); -$device = device_by_id_cache($sla['device_id']); - -// if ($_GET['width'] >= "450") { $descr_len = "48"; } else { $descr_len = "21"; } -$descr_len = (intval(($_GET['width'] / 8)) * 0.8); - -$unit_long = 'milliseconds'; -$unit = 'ms'; - -$rrd_options .= ' -l 0 -E '; -$rrd_options .= " COMMENT:'".str_pad($unit_long, $descr_len)." Cur Min Max\\n'"; - -$name = ''; -if ($sla['tag']) { - $name .= $sla['tag']; -} +$sla = dbFetchRow('SELECT `sla_nr` FROM `slas` WHERE `sla_id` = ?', array($vars['id'])); if ($sla['owner']) { $name .= ' (Owner: '.$sla['owner'].')'; } -$rrd_file = rrd_name($device['hostname'], array('sla', $sla['sla_nr'])); +$rrd_filename = rrd_name($device['hostname'], array('sla', $sla['sla_nr'])); -$rrd_options .= " DEF:rtt=$rrd_file:rtt:AVERAGE "; +$rrd_options .= " COMMENT:'Round Trip Time Cur Min Max\\n'"; +$rrd_options .= " DEF:rtt=$rrd_filename:rtt:AVERAGE "; $rrd_options .= ' VDEF:avg=rtt,AVERAGE '; -$rrd_options .= " LINE1:avg#CCCCFF:'".str_pad('Average', ($descr_len - 3))."':dashes"; -$rrd_options .= ' GPRINT:rtt:AVERAGE:%4.1lf'.$unit.'\\\l '; -$rrd_options .= " LINE1:rtt#CC0000:'".rrdtool_escape($descr, ($descr_len - 3))."'"; -$rrd_options .= ' GPRINT:rtt:LAST:%4.1lf'.$unit.' '; -$rrd_options .= ' GPRINT:rtt:MIN:%4.1lf'.$unit.' '; -$rrd_options .= ' GPRINT:rtt:MAX:%4.1lf'.$unit.'\\\l '; +$rrd_options .= " LINE1:avg#CCCCFF:'Average':dashes"; +$rrd_options .= ' GPRINT:rtt:AVERAGE:%4.1lfms\\\l '; +$rrd_options .= " LINE1:rtt#CC0000:'RTT'"; +$rrd_options .= ' GPRINT:rtt:LAST:%4.1lfms '; +$rrd_options .= ' GPRINT:rtt:MIN:%4.1lfms '; +$rrd_options .= ' GPRINT:rtt:MAX:%4.1lfms\\\l '; diff --git a/html/includes/graphs/device/sla_jitter-icpif.inc.php b/html/includes/graphs/device/sla_jitter-icpif.inc.php new file mode 100644 index 0000000000..4563da726c --- /dev/null +++ b/html/includes/graphs/device/sla_jitter-icpif.inc.php @@ -0,0 +1,28 @@ + + * + * 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. + */ + +$sla = dbFetchRow('SELECT `sla_nr` FROM `slas` WHERE `sla_id` = ?', array($vars['id'])); + +require 'includes/graphs/common.inc.php'; +$rrd_options .= ' -l 0 -E '; +$rrd_filename = rrd_name($device['hostname'], array('sla', $sla['sla_nr'], 'jitter')); + +if (file_exists($rrd_filename)) { + $rrd_options .= " COMMENT:' Cur Min Max\\n'"; + + $rrd_options .= " DEF:ICPIF=" . $rrd_filename . ":ICPIF:AVERAGE "; + $rrd_options .= " LINE1.25:ICPIF#0000ee:'ICPIF ' "; + $rrd_options .= " GPRINT:ICPIF:LAST:%3.0lf "; + $rrd_options .= " GPRINT:ICPIF:MIN:%3.0lf "; + $rrd_options .= " GPRINT:ICPIF:MAX:%3.0lf\\\l "; +} diff --git a/html/includes/graphs/device/sla_jitter-latency.inc.php b/html/includes/graphs/device/sla_jitter-latency.inc.php new file mode 100644 index 0000000000..a363dbfbe7 --- /dev/null +++ b/html/includes/graphs/device/sla_jitter-latency.inc.php @@ -0,0 +1,34 @@ + + * + * 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. + */ + +$sla = dbFetchRow('SELECT `sla_nr` FROM `slas` WHERE `sla_id` = ?', array($vars['id'])); + +require 'includes/graphs/common.inc.php'; +$rrd_options .= ' -l 0 -E '; +$rrd_filename = rrd_name($device['hostname'], array('sla', $sla['sla_nr'], 'jitter')); + +if (file_exists($rrd_filename)) { + $rrd_options .= " COMMENT:' Cur Min Max\\n'"; + + $rrd_options .= " DEF:SD=" . $rrd_filename . ":OWAvgSD:AVERAGE "; + $rrd_options .= " LINE1.25:SD#0000ee:'Src to Dst ' "; + $rrd_options .= " GPRINT:SD:LAST:%3.0lf "; + $rrd_options .= " GPRINT:SD:MIN:%3.0lf "; + $rrd_options .= " GPRINT:SD:MAX:%3.0lf\\\l "; + + $rrd_options .= " DEF:DS=" . $rrd_filename . ":OWAvgDS:AVERAGE "; + $rrd_options .= " LINE1.25:DS#008C00:'Dst to Src ' "; + $rrd_options .= " GPRINT:DS:LAST:%3.0lf "; + $rrd_options .= " GPRINT:DS:MIN:%3.0lf "; + $rrd_options .= " GPRINT:DS:MAX:%3.0lf\\\l "; +} diff --git a/html/includes/graphs/device/sla_jitter-loss.inc.php b/html/includes/graphs/device/sla_jitter-loss.inc.php new file mode 100644 index 0000000000..8c31fae3ed --- /dev/null +++ b/html/includes/graphs/device/sla_jitter-loss.inc.php @@ -0,0 +1,34 @@ + + * + * 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. + */ + +$sla = dbFetchRow('SELECT `sla_nr` FROM `slas` WHERE `sla_id` = ?', array($vars['id'])); + +require 'includes/graphs/common.inc.php'; +$rrd_options .= ' -l 0 -E '; +$rrd_filename = rrd_name($device['hostname'], array('sla', $sla['sla_nr'], 'jitter')); + +if (file_exists($rrd_filename)) { + $rrd_options .= " COMMENT:' Cur Min Max\\n'"; + + $rrd_options .= " DEF:SD=" . $rrd_filename . ":PacketLossSD:AVERAGE "; + $rrd_options .= " LINE1.25:SD#0000ee:'Src to Dst ' "; + $rrd_options .= " GPRINT:SD:LAST:%3.0lf "; + $rrd_options .= " GPRINT:SD:MIN:%3.0lf "; + $rrd_options .= " GPRINT:SD:MAX:%3.0lf\\\l "; + + $rrd_options .= " DEF:DS=" . $rrd_filename . ":PacketLossDS:AVERAGE "; + $rrd_options .= " LINE1.25:DS#008C00:'Dst to Src ' "; + $rrd_options .= " GPRINT:DS:LAST:%3.0lf "; + $rrd_options .= " GPRINT:DS:MIN:%3.0lf "; + $rrd_options .= " GPRINT:DS:MAX:%3.0lf\\\l "; +} diff --git a/html/includes/graphs/device/sla_jitter-lost.inc.php b/html/includes/graphs/device/sla_jitter-lost.inc.php new file mode 100644 index 0000000000..82e550d84e --- /dev/null +++ b/html/includes/graphs/device/sla_jitter-lost.inc.php @@ -0,0 +1,40 @@ + + * + * 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. + */ + +$sla = dbFetchRow('SELECT `sla_nr` FROM `slas` WHERE `sla_id` = ?', array($vars['id'])); + +require 'includes/graphs/common.inc.php'; +$rrd_options .= ' -l 0 -E '; +$rrd_filename = rrd_name($device['hostname'], array('sla', $sla['sla_nr'], 'jitter')); + +if (file_exists($rrd_filename)) { + $rrd_options .= " COMMENT:' Cur Min Max\\n'"; + + $rrd_options .= " DEF:POS=" . $rrd_filename . ":PacketOutOfSequence:AVERAGE "; + $rrd_options .= " LINE1.25:POS#0000ee:'Out of Sequence ' "; + $rrd_options .= " GPRINT:POS:LAST:%3.0lf "; + $rrd_options .= " GPRINT:POS:MIN:%3.0lf "; + $rrd_options .= " GPRINT:POS:MAX:%3.0lf\\\l "; + + $rrd_options .= " DEF:MIA=" . $rrd_filename . ":PacketMIA:AVERAGE "; + $rrd_options .= " LINE1.25:MIA#008C00:'Missing in Action ' "; + $rrd_options .= " GPRINT:MIA:LAST:%3.0lf "; + $rrd_options .= " GPRINT:MIA:MIN:%3.0lf "; + $rrd_options .= " GPRINT:MIA:MAX:%3.0lf\\\l "; + + $rrd_options .= " DEF:PLA=" . $rrd_filename . ":PacketLateArrival:AVERAGE "; + $rrd_options .= " LINE1.25:PLA#CC0000:'Late Arrival ' "; + $rrd_options .= " GPRINT:PLA:LAST:%3.0lf "; + $rrd_options .= " GPRINT:PLA:MIN:%3.0lf "; + $rrd_options .= " GPRINT:PLA:MAX:%3.0lf\\\l "; +} diff --git a/html/includes/graphs/device/sla_jitter-mos.inc.php b/html/includes/graphs/device/sla_jitter-mos.inc.php new file mode 100644 index 0000000000..2b743a495f --- /dev/null +++ b/html/includes/graphs/device/sla_jitter-mos.inc.php @@ -0,0 +1,28 @@ + + * + * 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. + */ + +$sla = dbFetchRow('SELECT `sla_nr` FROM `slas` WHERE `sla_id` = ?', array($vars['id'])); + +require 'includes/graphs/common.inc.php'; +$rrd_options .= ' -l 0 -E '; +$rrd_filename = rrd_name($device['hostname'], array('sla', $sla['sla_nr'], 'jitter')); + +if (file_exists($rrd_filename)) { + $rrd_options .= " COMMENT:' Cur Min Max\\n'"; + + $rrd_options .= " DEF:MOS=" . $rrd_filename . ":MOS:AVERAGE "; + $rrd_options .= " LINE1.25:MOS#0000ee:'Mean Opinion Score ' "; + $rrd_options .= " GPRINT:MOS:LAST:%3.0lf "; + $rrd_options .= " GPRINT:MOS:MIN:%3.0lf "; + $rrd_options .= " GPRINT:MOS:MAX:%3.0lf\\\l "; +} diff --git a/html/includes/graphs/device/sla_jitter.inc.php b/html/includes/graphs/device/sla_jitter.inc.php new file mode 100644 index 0000000000..2abe1507c6 --- /dev/null +++ b/html/includes/graphs/device/sla_jitter.inc.php @@ -0,0 +1,34 @@ + + * + * 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. + */ + +$sla = dbFetchRow('SELECT `sla_nr` FROM `slas` WHERE `sla_id` = ?', array($vars['id'])); + +require 'includes/graphs/common.inc.php'; +$rrd_options .= ' -l 0 -E '; +$rrd_filename = rrd_name($device['hostname'], array('sla', $sla['sla_nr'], 'jitter')); + +if (file_exists($rrd_filename)) { + $rrd_options .= " COMMENT:' Cur Min Max\\n'"; + + $rrd_options .= " DEF:SD=" . $rrd_filename . ":AvgSDJ:AVERAGE "; + $rrd_options .= " LINE1.25:SD#0000ee:'Src to Dst ' "; + $rrd_options .= " GPRINT:SD:LAST:%3.0lf "; + $rrd_options .= " GPRINT:SD:MIN:%3.0lf "; + $rrd_options .= " GPRINT:SD:MAX:%3.0lf\\\l "; + + $rrd_options .= " DEF:DS=" . $rrd_filename . ":AvgDSJ:AVERAGE "; + $rrd_options .= " LINE1.25:DS#008C00:'Dst to Src ' "; + $rrd_options .= " GPRINT:DS:LAST:%3.0lf "; + $rrd_options .= " GPRINT:DS:MIN:%3.0lf "; + $rrd_options .= " GPRINT:DS:MAX:%3.0lf\\\l "; +} diff --git a/html/includes/graphs/device/xirrus_dataRates.inc.php b/html/includes/graphs/device/xirrus_dataRates.inc.php index 257ddbea0e..5a716b5c08 100644 --- a/html/includes/graphs/device/xirrus_dataRates.inc.php +++ b/html/includes/graphs/device/xirrus_dataRates.inc.php @@ -24,7 +24,7 @@ $pallette = array( $rrd_options .= ' -l 0 -E '; $rrd_options .= " COMMENT:'Average Data Rate Cur Min Max\\n'"; $radioId=1; -foreach(glob(rrd_name($device['hostname'], 'xirrus_stats-*')) as $rrd) { +foreach(glob(rrd_name($device['hostname'], 'xirrus_stats-', '*.rrd')) as $rrd) { // get radio name preg_match("/xirrus_stats-iap([0-9]{1,2}).rrd/", $rrd, $out); list(,$radioId)=$out; diff --git a/html/includes/graphs/device/xirrus_noiseFloor.inc.php b/html/includes/graphs/device/xirrus_noiseFloor.inc.php index 148f55be93..f6e00420cd 100644 --- a/html/includes/graphs/device/xirrus_noiseFloor.inc.php +++ b/html/includes/graphs/device/xirrus_noiseFloor.inc.php @@ -24,7 +24,7 @@ $pallette = array( $rrd_options .= ' -E '; $rrd_options .= " COMMENT:'Noisefloor Cur Min Max\\n'"; $radioId=1; -foreach(glob(rrd_name($device['hostname'], 'xirrus_stats-*')) as $rrd) { +foreach(glob(rrd_name($device['hostname'], 'xirrus_stats-', '*.rrd')) as $rrd) { // get radio name preg_match("/xirrus_stats-iap([0-9]{1,2}).rrd/", $rrd, $out); list(,$radioId)=$out; diff --git a/html/includes/graphs/device/xirrus_rssi.inc.php b/html/includes/graphs/device/xirrus_rssi.inc.php index dc8387edc1..97812ec531 100644 --- a/html/includes/graphs/device/xirrus_rssi.inc.php +++ b/html/includes/graphs/device/xirrus_rssi.inc.php @@ -24,7 +24,7 @@ $pallette = array( $rrd_options .= ' -E '; $rrd_options .= " COMMENT:'Signal RSSI Cur Min Max\\n'"; $radioId=1; -foreach(glob(rrd_name($device['hostname'], 'xirrus_stats-*')) as $rrd) { +foreach(glob(rrd_name($device['hostname'], 'xirrus_stats-', '*.rrd')) as $rrd) { // get radio name preg_match("/xirrus_stats-iap([0-9]{1,2}).rrd/", $rrd, $out); list(,$radioId)=$out; diff --git a/html/includes/graphs/device/xirrus_stations.inc.php b/html/includes/graphs/device/xirrus_stations.inc.php index 5feeaaeea2..329c114eb2 100644 --- a/html/includes/graphs/device/xirrus_stations.inc.php +++ b/html/includes/graphs/device/xirrus_stations.inc.php @@ -24,7 +24,7 @@ $pallette = array( $rrd_options .= ' -l 0 -E '; $rrd_options .= " COMMENT:'Associated Stations Cur Min Max\\n'"; $radioId=1; -foreach(glob(rrd_name($device['hostname'], 'xirrus_users-*')) as $rrd) { +foreach(glob(rrd_name($device['hostname'], 'xirrus_users-', '*.rrd')) as $rrd) { // get radio name preg_match("/xirrus_users-iap([0-9]{1,2}).rrd/", $rrd, $out); list(,$radioId)=$out; diff --git a/html/includes/graphs/sensor/power.inc.php b/html/includes/graphs/sensor/power.inc.php index c279bb80a5..30751645fe 100644 --- a/html/includes/graphs/sensor/power.inc.php +++ b/html/includes/graphs/sensor/power.inc.php @@ -14,8 +14,13 @@ $rrd_options .= " DEF:sensor_min=$rrd_filename:sensor:MIN"; $rrd_options .= ' AREA:sensor_max#c5c5c5'; $rrd_options .= ' AREA:sensor_min#ffffffff'; -// $rrd_options .= " AREA:sensor#FFFF99"; -$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape($sensor['sensor_descr'], 22)."'"; +if($sensor['poller_type'] == "ipmi") +{ + $rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape(ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames), 21)."'"; +} else { + $rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape($sensor['sensor_descr'], 21)."'"; +} + $rrd_options .= ' GPRINT:sensor:LAST:%6.2lfW'; $rrd_options .= ' GPRINT:sensor:MAX:%6.2lfW\\\\l'; diff --git a/html/includes/graphs/sensor/temperature.inc.php b/html/includes/graphs/sensor/temperature.inc.php index 05f7ed0ef5..7dd624efd8 100644 --- a/html/includes/graphs/sensor/temperature.inc.php +++ b/html/includes/graphs/sensor/temperature.inc.php @@ -1,5 +1,4 @@ + * + * 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. + */ + +$sla = dbFetchRow('SELECT `sla_nr` FROM `slas` WHERE `sla_id` = ?', array($vars['id'])); + +require 'includes/graphs/common.inc.php'; +$rrd_options .= ' -l 0 -E '; +$rrd_filename = $config['rrd_dir']."/".$device['hostname']."/".safename('sla-'.$sla['sla_nr'].'-jitter.rrd'); + +if (file_exists($rrd_filename)) { + $rrd_options .= " COMMENT:' Cur Min Max\\n'"; + + $rrd_options .= " DEF:SD=" . $rrd_filename . ":AvgSDJ:AVERAGE "; + $rrd_options .= " LINE1.25:SD#0000ee:'Src to Dst ' "; + $rrd_options .= " GPRINT:SD:LAST:%3.0lf "; + $rrd_options .= " GPRINT:SD:MIN:%3.0lf "; + $rrd_options .= " GPRINT:SD:MAX:%3.0lf\\\l "; + + $rrd_options .= " DEF:DS=" . $rrd_filename . ":AvgDSJ:AVERAGE "; + $rrd_options .= " LINE1.25:DS#008C00:'Dst to Src ' "; + $rrd_options .= " GPRINT:DS:LAST:%3.0lf "; + $rrd_options .= " GPRINT:DS:MIN:%3.0lf "; + $rrd_options .= " GPRINT:DS:MAX:%3.0lf\\\l "; +} diff --git a/html/includes/jpgraph/README b/html/includes/jpgraph/README deleted file mode 100644 index 963cc5c8f1..0000000000 --- a/html/includes/jpgraph/README +++ /dev/null @@ -1,71 +0,0 @@ -README FOR JPGRAPH 3.0.x -======================== - -This package contains JpGraph, an Object Oriented PHP5 Graph Plotting library. - -The library is Copyright (C) 2001-2009 Aditus Consulting and -released under dual license QPL 1.0 for open source and educational -use and JpGraph Professional License for commercial use. - -Please see full license details at http://www.aditus.nu/jpgraph/ - -* -------------------------------------------------------------------- -* PHP4 IS NOT SUPPORTED in the 2.x or 3.x series -* -------------------------------------------------------------------- - -Requirements: -------------- -Miminum: -* PHP 5.1.0 or higher -* GD 2.0.28 or higher -Note: Earlier versions might work but is unsupported. - -Recommended: -* PHP >= 5.2.0 -* PHP Built-in GD library - -Installation ------------- -0. Make sure that the PHP version is compatible with the stated requirements - and that the PHP installation has support for the GD library. - Please run phpinfo() to check if GD library - is supported in the installation. - If the GD library doesn't seem to be installed - please consult the PHP manual under section "Image" for - instructions on where to find this library. Please refer to - the manual section "Verifying your PHP installation" - -1. Unzip and copy the files to a directory of your choice where Your - httpd sever can access them. - For a global site installation you should copy the files to - somewhere in the PHP search path. - -2. Check that the default directory paths in jpg-config.inc - for cache directory and TTF directory suits your installation. - Note1: The default directories are different depending on if - the library is running on Windows or UNIX. - Note2: Apache/PHP must have write permission to your cache - directory if you enable the cache feature. By default the cache - is disabled. - -3. Check that all rest of the DEFINE in jpg-config.inc - is setup to your preference. The default should be fine - for most users. - -4. Read the chapters on installation in the manual. - - -Documentation -------------- -The installation includes HTML documentation and reference guide for the -library. The portal page for all the documentation is -/docs/index.html - - -Bug reports and suggestions ---------------------------- -Should be reported using the the issue tracker at - -http://www.aditus.nu/bugtraq - - diff --git a/html/includes/jpgraph/VERSION b/html/includes/jpgraph/VERSION deleted file mode 100644 index 92f61ae6bd..0000000000 --- a/html/includes/jpgraph/VERSION +++ /dev/null @@ -1 +0,0 @@ -Version: v3.0.7, Build: r1928, Exported: Mon, 11 Jan 2010 at 23:34 (UTC+2), w1002.1 diff --git a/html/js/librenms.js b/html/js/librenms.js index f103ea29b0..8bed8ff000 100644 --- a/html/js/librenms.js +++ b/html/js/librenms.js @@ -225,6 +225,17 @@ $(document).on("click", '.collapse-neighbors', function(event) }); +$(document).on("change", '#mode', function() { + $.post('ajax_mapview.php', + { + mapView: $(this).val() + }, + function(data) { + location.reload(); + },'json' + ); +}); + $(document).ready(function() { var lines = 'on'; $("#linenumbers").button().click(function() { diff --git a/html/includes/PasswordHash.php b/html/lib/PasswordHash.php similarity index 100% rename from html/includes/PasswordHash.php rename to html/lib/PasswordHash.php diff --git a/html/includes/Slim/Environment.php b/html/lib/Slim/Environment.php similarity index 100% rename from html/includes/Slim/Environment.php rename to html/lib/Slim/Environment.php diff --git a/html/includes/Slim/Exception/Pass.php b/html/lib/Slim/Exception/Pass.php similarity index 100% rename from html/includes/Slim/Exception/Pass.php rename to html/lib/Slim/Exception/Pass.php diff --git a/html/includes/Slim/Exception/Stop.php b/html/lib/Slim/Exception/Stop.php similarity index 100% rename from html/includes/Slim/Exception/Stop.php rename to html/lib/Slim/Exception/Stop.php diff --git a/html/includes/Slim/Helper/Set.php b/html/lib/Slim/Helper/Set.php similarity index 100% rename from html/includes/Slim/Helper/Set.php rename to html/lib/Slim/Helper/Set.php diff --git a/html/includes/Slim/Http/Cookies.php b/html/lib/Slim/Http/Cookies.php similarity index 100% rename from html/includes/Slim/Http/Cookies.php rename to html/lib/Slim/Http/Cookies.php diff --git a/html/includes/Slim/Http/Headers.php b/html/lib/Slim/Http/Headers.php similarity index 100% rename from html/includes/Slim/Http/Headers.php rename to html/lib/Slim/Http/Headers.php diff --git a/html/includes/Slim/Http/Request.php b/html/lib/Slim/Http/Request.php similarity index 100% rename from html/includes/Slim/Http/Request.php rename to html/lib/Slim/Http/Request.php diff --git a/html/includes/Slim/Http/Response.php b/html/lib/Slim/Http/Response.php similarity index 100% rename from html/includes/Slim/Http/Response.php rename to html/lib/Slim/Http/Response.php diff --git a/html/includes/Slim/Http/Util.php b/html/lib/Slim/Http/Util.php similarity index 100% rename from html/includes/Slim/Http/Util.php rename to html/lib/Slim/Http/Util.php diff --git a/html/includes/Slim/Log.php b/html/lib/Slim/Log.php similarity index 100% rename from html/includes/Slim/Log.php rename to html/lib/Slim/Log.php diff --git a/html/includes/Slim/LogWriter.php b/html/lib/Slim/LogWriter.php similarity index 100% rename from html/includes/Slim/LogWriter.php rename to html/lib/Slim/LogWriter.php diff --git a/html/includes/Slim/Middleware.php b/html/lib/Slim/Middleware.php similarity index 100% rename from html/includes/Slim/Middleware.php rename to html/lib/Slim/Middleware.php diff --git a/html/includes/Slim/Middleware/ContentTypes.php b/html/lib/Slim/Middleware/ContentTypes.php similarity index 100% rename from html/includes/Slim/Middleware/ContentTypes.php rename to html/lib/Slim/Middleware/ContentTypes.php diff --git a/html/includes/Slim/Middleware/Flash.php b/html/lib/Slim/Middleware/Flash.php similarity index 100% rename from html/includes/Slim/Middleware/Flash.php rename to html/lib/Slim/Middleware/Flash.php diff --git a/html/includes/Slim/Middleware/MethodOverride.php b/html/lib/Slim/Middleware/MethodOverride.php similarity index 100% rename from html/includes/Slim/Middleware/MethodOverride.php rename to html/lib/Slim/Middleware/MethodOverride.php diff --git a/html/includes/Slim/Middleware/PrettyExceptions.php b/html/lib/Slim/Middleware/PrettyExceptions.php similarity index 100% rename from html/includes/Slim/Middleware/PrettyExceptions.php rename to html/lib/Slim/Middleware/PrettyExceptions.php diff --git a/html/includes/Slim/Middleware/SessionCookie.php b/html/lib/Slim/Middleware/SessionCookie.php similarity index 100% rename from html/includes/Slim/Middleware/SessionCookie.php rename to html/lib/Slim/Middleware/SessionCookie.php diff --git a/html/includes/Slim/Route.php b/html/lib/Slim/Route.php similarity index 100% rename from html/includes/Slim/Route.php rename to html/lib/Slim/Route.php diff --git a/html/includes/Slim/Router.php b/html/lib/Slim/Router.php similarity index 100% rename from html/includes/Slim/Router.php rename to html/lib/Slim/Router.php diff --git a/html/includes/Slim/Slim.php b/html/lib/Slim/Slim.php similarity index 100% rename from html/includes/Slim/Slim.php rename to html/lib/Slim/Slim.php diff --git a/html/includes/Slim/View.php b/html/lib/Slim/View.php similarity index 100% rename from html/includes/Slim/View.php rename to html/lib/Slim/View.php diff --git a/html/includes/geshi/geshi.php b/html/lib/geshi/geshi.php similarity index 100% rename from html/includes/geshi/geshi.php rename to html/lib/geshi/geshi.php diff --git a/html/includes/geshi/geshi/diff.php b/html/lib/geshi/geshi/diff.php similarity index 100% rename from html/includes/geshi/geshi/diff.php rename to html/lib/geshi/geshi/diff.php diff --git a/html/includes/geshi/geshi/ios.php b/html/lib/geshi/geshi/ios.php similarity index 100% rename from html/includes/geshi/geshi/ios.php rename to html/lib/geshi/geshi/ios.php diff --git a/html/includes/jpgraph/src/contour_dev/findpolygon.php b/html/lib/jpgraph/contour_dev/findpolygon.php similarity index 100% rename from html/includes/jpgraph/src/contour_dev/findpolygon.php rename to html/lib/jpgraph/contour_dev/findpolygon.php diff --git a/html/includes/jpgraph/src/contour_dev/tri-quad.php b/html/lib/jpgraph/contour_dev/tri-quad.php similarity index 100% rename from html/includes/jpgraph/src/contour_dev/tri-quad.php rename to html/lib/jpgraph/contour_dev/tri-quad.php diff --git a/html/includes/jpgraph/src/flag_mapping b/html/lib/jpgraph/flag_mapping similarity index 100% rename from html/includes/jpgraph/src/flag_mapping rename to html/lib/jpgraph/flag_mapping diff --git a/html/includes/jpgraph/src/flags.dat b/html/lib/jpgraph/flags.dat similarity index 100% rename from html/includes/jpgraph/src/flags.dat rename to html/lib/jpgraph/flags.dat diff --git a/html/includes/jpgraph/src/flags_thumb100x100.dat b/html/lib/jpgraph/flags_thumb100x100.dat similarity index 100% rename from html/includes/jpgraph/src/flags_thumb100x100.dat rename to html/lib/jpgraph/flags_thumb100x100.dat diff --git a/html/includes/jpgraph/src/flags_thumb35x35.dat b/html/lib/jpgraph/flags_thumb35x35.dat similarity index 100% rename from html/includes/jpgraph/src/flags_thumb35x35.dat rename to html/lib/jpgraph/flags_thumb35x35.dat diff --git a/html/includes/jpgraph/src/flags_thumb60x60.dat b/html/lib/jpgraph/flags_thumb60x60.dat similarity index 100% rename from html/includes/jpgraph/src/flags_thumb60x60.dat rename to html/lib/jpgraph/flags_thumb60x60.dat diff --git a/html/includes/jpgraph/src/gd_image.inc.php b/html/lib/jpgraph/gd_image.inc.php similarity index 98% rename from html/includes/jpgraph/src/gd_image.inc.php rename to html/lib/jpgraph/gd_image.inc.php index c2ec49e888..913558914b 100644 --- a/html/includes/jpgraph/src/gd_image.inc.php +++ b/html/lib/jpgraph/gd_image.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: GD_IMAGE.INC.PHP // Description: PHP Graph Plotting library. Low level image drawing routines diff --git a/html/includes/jpgraph/src/imgdata_balls.inc.php b/html/lib/jpgraph/imgdata_balls.inc.php similarity index 98% rename from html/includes/jpgraph/src/imgdata_balls.inc.php rename to html/lib/jpgraph/imgdata_balls.inc.php index abc43d091f..651c51a67f 100644 --- a/html/includes/jpgraph/src/imgdata_balls.inc.php +++ b/html/lib/jpgraph/imgdata_balls.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: IMGDATA_ROUNDBALLS.INC // Description: Base64 encoded images for small round markers diff --git a/html/includes/jpgraph/src/imgdata_bevels.inc.php b/html/lib/jpgraph/imgdata_bevels.inc.php similarity index 84% rename from html/includes/jpgraph/src/imgdata_bevels.inc.php rename to html/lib/jpgraph/imgdata_bevels.inc.php index 2cd545f74f..2dab45fc55 100644 --- a/html/includes/jpgraph/src/imgdata_bevels.inc.php +++ b/html/lib/jpgraph/imgdata_bevels.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: IMGDATA_BEVELS.INC // Description: Base64 encoded images for round bevels diff --git a/html/includes/jpgraph/src/imgdata_diamonds.inc.php b/html/lib/jpgraph/imgdata_diamonds.inc.php similarity index 91% rename from html/includes/jpgraph/src/imgdata_diamonds.inc.php rename to html/lib/jpgraph/imgdata_diamonds.inc.php index 533cd4753c..c911a97031 100644 --- a/html/includes/jpgraph/src/imgdata_diamonds.inc.php +++ b/html/lib/jpgraph/imgdata_diamonds.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: IMGDATA_DIAMONDS.INC // Description: Base64 encoded images for diamonds diff --git a/html/includes/jpgraph/src/imgdata_pushpins.inc.php b/html/lib/jpgraph/imgdata_pushpins.inc.php similarity index 97% rename from html/includes/jpgraph/src/imgdata_pushpins.inc.php rename to html/lib/jpgraph/imgdata_pushpins.inc.php index 53e0b159a7..f15d115e25 100644 --- a/html/includes/jpgraph/src/imgdata_pushpins.inc.php +++ b/html/lib/jpgraph/imgdata_pushpins.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: IMGDATA_PUSHPINS.INC // Description: Base64 encoded images for pushpins diff --git a/html/includes/jpgraph/src/imgdata_squares.inc.php b/html/lib/jpgraph/imgdata_squares.inc.php similarity index 89% rename from html/includes/jpgraph/src/imgdata_squares.inc.php rename to html/lib/jpgraph/imgdata_squares.inc.php index b17faf0449..e420b0a243 100644 --- a/html/includes/jpgraph/src/imgdata_squares.inc.php +++ b/html/lib/jpgraph/imgdata_squares.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: IMGDATA_SQUARES.INC // Description: Base64 encoded images for squares diff --git a/html/includes/jpgraph/src/imgdata_stars.inc.php b/html/lib/jpgraph/imgdata_stars.inc.php similarity index 89% rename from html/includes/jpgraph/src/imgdata_stars.inc.php rename to html/lib/jpgraph/imgdata_stars.inc.php index 3c5f799a85..44d638ef10 100644 --- a/html/includes/jpgraph/src/imgdata_stars.inc.php +++ b/html/lib/jpgraph/imgdata_stars.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: IMGDATA_STARS.INC // Description: Base64 encoded images for stars diff --git a/html/includes/jpgraph/src/jpg-config.inc.php b/html/lib/jpgraph/jpg-config.inc.php similarity index 87% rename from html/includes/jpgraph/src/jpg-config.inc.php rename to html/lib/jpgraph/jpg-config.inc.php index 35081fa05f..f7ce5b7f6b 100644 --- a/html/includes/jpgraph/src/jpg-config.inc.php +++ b/html/lib/jpgraph/jpg-config.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPG-CONFIG.INC // Description: Configuration file for JpGraph library diff --git a/html/includes/jpgraph/src/jpgraph.php b/html/lib/jpgraph/jpgraph.php similarity index 99% rename from html/includes/jpgraph/src/jpgraph.php rename to html/lib/jpgraph/jpgraph.php index a92e58836f..0eba4e3190 100644 --- a/html/includes/jpgraph/src/jpgraph.php +++ b/html/lib/jpgraph/jpgraph.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH.PHP // Description: PHP Graph Plotting library. Base module. diff --git a/html/includes/jpgraph/src/jpgraph_antispam-digits.php b/html/lib/jpgraph/jpgraph_antispam-digits.php similarity index 93% rename from html/includes/jpgraph/src/jpgraph_antispam-digits.php rename to html/lib/jpgraph/jpgraph_antispam-digits.php index f3cff8ae5d..c032353d68 100644 --- a/html/includes/jpgraph/src/jpgraph_antispam-digits.php +++ b/html/lib/jpgraph/jpgraph_antispam-digits.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_ANTISPAM.PHP // Description: Genarate anti-spam challenge diff --git a/html/includes/jpgraph/src/jpgraph_antispam.php b/html/lib/jpgraph/jpgraph_antispam.php similarity index 98% rename from html/includes/jpgraph/src/jpgraph_antispam.php rename to html/lib/jpgraph/jpgraph_antispam.php index e9c995a745..ed2b1737ee 100644 --- a/html/includes/jpgraph/src/jpgraph_antispam.php +++ b/html/lib/jpgraph/jpgraph_antispam.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_ANTISPAM.PHP // Description: Genarate anti-spam challenge diff --git a/html/includes/jpgraph/src/jpgraph_bar.php b/html/lib/jpgraph/jpgraph_bar.php similarity index 98% rename from html/includes/jpgraph/src/jpgraph_bar.php rename to html/lib/jpgraph/jpgraph_bar.php index 10a5ddfd27..92d8eb7868 100644 --- a/html/includes/jpgraph/src/jpgraph_bar.php +++ b/html/lib/jpgraph/jpgraph_bar.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_BAR.PHP // Description: Bar plot extension for JpGraph diff --git a/html/includes/jpgraph/src/jpgraph_canvas.php b/html/lib/jpgraph/jpgraph_canvas.php similarity index 80% rename from html/includes/jpgraph/src/jpgraph_canvas.php rename to html/lib/jpgraph/jpgraph_canvas.php index 4e9f9645b1..f6e23e47e6 100644 --- a/html/includes/jpgraph/src/jpgraph_canvas.php +++ b/html/lib/jpgraph/jpgraph_canvas.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_CANVAS.PHP // Description: Canvas drawing extension for JpGraph diff --git a/html/includes/jpgraph/src/jpgraph_canvtools.php b/html/lib/jpgraph/jpgraph_canvtools.php similarity index 95% rename from html/includes/jpgraph/src/jpgraph_canvtools.php rename to html/lib/jpgraph/jpgraph_canvtools.php index bb821bfa0e..ff8e010f54 100644 --- a/html/includes/jpgraph/src/jpgraph_canvtools.php +++ b/html/lib/jpgraph/jpgraph_canvtools.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_CANVTOOLS.PHP // Description: Some utilities for text and shape drawing on a canvas diff --git a/html/includes/jpgraph/src/jpgraph_contour.php b/html/lib/jpgraph/jpgraph_contour.php similarity index 96% rename from html/includes/jpgraph/src/jpgraph_contour.php rename to html/lib/jpgraph/jpgraph_contour.php index 0b23cdec40..148eda9d8f 100644 --- a/html/includes/jpgraph/src/jpgraph_contour.php +++ b/html/lib/jpgraph/jpgraph_contour.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_CONTOUR.PHP // Description: Contour plot diff --git a/html/includes/jpgraph/src/jpgraph_date.php b/html/lib/jpgraph/jpgraph_date.php similarity index 95% rename from html/includes/jpgraph/src/jpgraph_date.php rename to html/lib/jpgraph/jpgraph_date.php index 6adc9e4bb8..0fe00b4148 100644 --- a/html/includes/jpgraph/src/jpgraph_date.php +++ b/html/lib/jpgraph/jpgraph_date.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_DATE.PHP // Description: Classes to handle Date scaling diff --git a/html/includes/jpgraph/src/jpgraph_errhandler.inc.php b/html/lib/jpgraph/jpgraph_errhandler.inc.php similarity index 93% rename from html/includes/jpgraph/src/jpgraph_errhandler.inc.php rename to html/lib/jpgraph/jpgraph_errhandler.inc.php index 68b5b5d46b..e325e8ffc0 100644 --- a/html/includes/jpgraph/src/jpgraph_errhandler.inc.php +++ b/html/lib/jpgraph/jpgraph_errhandler.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_ERRHANDLER.PHP // Description: Error handler class together with handling of localized diff --git a/html/includes/jpgraph/src/jpgraph_error.php b/html/lib/jpgraph/jpgraph_error.php similarity index 85% rename from html/includes/jpgraph/src/jpgraph_error.php rename to html/lib/jpgraph/jpgraph_error.php index 5e0857fbee..87f9ce8006 100644 --- a/html/includes/jpgraph/src/jpgraph_error.php +++ b/html/lib/jpgraph/jpgraph_error.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_ERROR.PHP // Description: Error plot extension for JpGraph diff --git a/html/includes/jpgraph/src/jpgraph_flags.php b/html/lib/jpgraph/jpgraph_flags.php similarity index 94% rename from html/includes/jpgraph/src/jpgraph_flags.php rename to html/lib/jpgraph/jpgraph_flags.php index 3bf902ddce..85295b1457 100644 --- a/html/includes/jpgraph/src/jpgraph_flags.php +++ b/html/lib/jpgraph/jpgraph_flags.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_FLAGS.PHP // Description: Class Jpfile. Handles plotmarks diff --git a/html/includes/jpgraph/src/jpgraph_gantt.php b/html/lib/jpgraph/jpgraph_gantt.php similarity index 99% rename from html/includes/jpgraph/src/jpgraph_gantt.php rename to html/lib/jpgraph/jpgraph_gantt.php index b8f0e5fc9f..635c17612b 100644 --- a/html/includes/jpgraph/src/jpgraph_gantt.php +++ b/html/lib/jpgraph/jpgraph_gantt.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_GANTT.PHP // Description: JpGraph Gantt plot extension diff --git a/html/includes/jpgraph/src/jpgraph_gb2312.php b/html/lib/jpgraph/jpgraph_gb2312.php similarity index 99% rename from html/includes/jpgraph/src/jpgraph_gb2312.php rename to html/lib/jpgraph/jpgraph_gb2312.php index bfaa58af02..0f272ac8f0 100644 --- a/html/includes/jpgraph/src/jpgraph_gb2312.php +++ b/html/lib/jpgraph/jpgraph_gb2312.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_GB2312.PHP // Description: Chinese font conversions diff --git a/html/includes/jpgraph/src/jpgraph_gradient.php b/html/lib/jpgraph/jpgraph_gradient.php similarity index 95% rename from html/includes/jpgraph/src/jpgraph_gradient.php rename to html/lib/jpgraph/jpgraph_gradient.php index a990b9ff45..ff299877dd 100644 --- a/html/includes/jpgraph/src/jpgraph_gradient.php +++ b/html/lib/jpgraph/jpgraph_gradient.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_GRADIENT.PHP // Description: Create a color gradient diff --git a/html/includes/jpgraph/src/jpgraph_iconplot.php b/html/lib/jpgraph/jpgraph_iconplot.php similarity index 87% rename from html/includes/jpgraph/src/jpgraph_iconplot.php rename to html/lib/jpgraph/jpgraph_iconplot.php index ca622314c1..f43cf36962 100644 --- a/html/includes/jpgraph/src/jpgraph_iconplot.php +++ b/html/lib/jpgraph/jpgraph_iconplot.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_ICONPLOT.PHP // Description: Extension module to add icons to plots diff --git a/html/includes/jpgraph/src/jpgraph_imgtrans.php b/html/lib/jpgraph/jpgraph_imgtrans.php similarity index 90% rename from html/includes/jpgraph/src/jpgraph_imgtrans.php rename to html/lib/jpgraph/jpgraph_imgtrans.php index 6f0cc07aa3..4d966d5751 100644 --- a/html/includes/jpgraph/src/jpgraph_imgtrans.php +++ b/html/lib/jpgraph/jpgraph_imgtrans.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_IMGTRANS.PHP // Description: Extension for JpGraph to do some simple img transformations diff --git a/html/includes/jpgraph/src/jpgraph_led.php b/html/lib/jpgraph/jpgraph_led.php similarity index 93% rename from html/includes/jpgraph/src/jpgraph_led.php rename to html/lib/jpgraph/jpgraph_led.php index 45cda1ba9e..accc5b69be 100644 --- a/html/includes/jpgraph/src/jpgraph_led.php +++ b/html/lib/jpgraph/jpgraph_led.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_LED.PHP // Description: Module to generate Dotted LED-like digits diff --git a/html/includes/jpgraph/src/jpgraph_legend.inc.php b/html/lib/jpgraph/jpgraph_legend.inc.php similarity index 95% rename from html/includes/jpgraph/src/jpgraph_legend.inc.php rename to html/lib/jpgraph/jpgraph_legend.inc.php index c1099c4728..9705edcc28 100644 --- a/html/includes/jpgraph/src/jpgraph_legend.inc.php +++ b/html/lib/jpgraph/jpgraph_legend.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_LEGEND.INC.PHP // Description: Class to handle the legend box in the graph that gives diff --git a/html/includes/jpgraph/src/jpgraph_line.php b/html/lib/jpgraph/jpgraph_line.php similarity index 96% rename from html/includes/jpgraph/src/jpgraph_line.php rename to html/lib/jpgraph/jpgraph_line.php index 3151fb4fc1..ef72f057c2 100644 --- a/html/includes/jpgraph/src/jpgraph_line.php +++ b/html/lib/jpgraph/jpgraph_line.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_LINE.PHP // Description: Line plot extension for JpGraph diff --git a/html/includes/jpgraph/src/jpgraph_log.php b/html/lib/jpgraph/jpgraph_log.php similarity index 92% rename from html/includes/jpgraph/src/jpgraph_log.php rename to html/lib/jpgraph/jpgraph_log.php index 58628c4e88..82b48d6a6c 100644 --- a/html/includes/jpgraph/src/jpgraph_log.php +++ b/html/lib/jpgraph/jpgraph_log.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_LOG.PHP // Description: Log scale plot extension for JpGraph diff --git a/html/includes/jpgraph/src/jpgraph_meshinterpolate.inc.php b/html/lib/jpgraph/jpgraph_meshinterpolate.inc.php similarity index 81% rename from html/includes/jpgraph/src/jpgraph_meshinterpolate.inc.php rename to html/lib/jpgraph/jpgraph_meshinterpolate.inc.php index bc9d6f0363..0aea48b38d 100644 --- a/html/includes/jpgraph/src/jpgraph_meshinterpolate.inc.php +++ b/html/lib/jpgraph/jpgraph_meshinterpolate.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_MESHINTERPOLATE.INC.PHP // Description: Utility class to do mesh linear interpolation of a matrix diff --git a/html/includes/jpgraph/src/jpgraph_mgraph.php b/html/lib/jpgraph/jpgraph_mgraph.php similarity index 93% rename from html/includes/jpgraph/src/jpgraph_mgraph.php rename to html/lib/jpgraph/jpgraph_mgraph.php index fbd8f5d89e..ae92210e72 100644 --- a/html/includes/jpgraph/src/jpgraph_mgraph.php +++ b/html/lib/jpgraph/jpgraph_mgraph.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_MGRAPH.PHP // Description: Class to handle multiple graphs in the same image diff --git a/html/includes/jpgraph/src/jpgraph_pie.php b/html/lib/jpgraph/jpgraph_pie.php similarity index 98% rename from html/includes/jpgraph/src/jpgraph_pie.php rename to html/lib/jpgraph/jpgraph_pie.php index a4208b4529..2b5872d635 100644 --- a/html/includes/jpgraph/src/jpgraph_pie.php +++ b/html/lib/jpgraph/jpgraph_pie.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_PIE.PHP // Description: Pie plot extension for JpGraph diff --git a/html/includes/jpgraph/src/jpgraph_pie3d.php b/html/lib/jpgraph/jpgraph_pie3d.php similarity index 97% rename from html/includes/jpgraph/src/jpgraph_pie3d.php rename to html/lib/jpgraph/jpgraph_pie3d.php index 45cb2b2b99..2c01e25fa4 100644 --- a/html/includes/jpgraph/src/jpgraph_pie3d.php +++ b/html/lib/jpgraph/jpgraph_pie3d.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_PIE3D.PHP // Description: 3D Pie plot extension for JpGraph diff --git a/html/includes/jpgraph/src/jpgraph_plotband.php b/html/lib/jpgraph/jpgraph_plotband.php similarity index 96% rename from html/includes/jpgraph/src/jpgraph_plotband.php rename to html/lib/jpgraph/jpgraph_plotband.php index 1c78d33a4a..3e7ae3ffee 100644 --- a/html/includes/jpgraph/src/jpgraph_plotband.php +++ b/html/lib/jpgraph/jpgraph_plotband.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_PLOTBAND.PHP // Description: PHP4 Graph Plotting library. Extension module. diff --git a/html/includes/jpgraph/src/jpgraph_plotline.php b/html/lib/jpgraph/jpgraph_plotline.php similarity index 83% rename from html/includes/jpgraph/src/jpgraph_plotline.php rename to html/lib/jpgraph/jpgraph_plotline.php index 7c19219e8f..13a203197c 100644 --- a/html/includes/jpgraph/src/jpgraph_plotline.php +++ b/html/lib/jpgraph/jpgraph_plotline.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_PLOTLINE.PHP // Description: PlotLine extension for JpGraph diff --git a/html/includes/jpgraph/src/jpgraph_plotmark.inc.php b/html/lib/jpgraph/jpgraph_plotmark.inc.php similarity index 95% rename from html/includes/jpgraph/src/jpgraph_plotmark.inc.php rename to html/lib/jpgraph/jpgraph_plotmark.inc.php index 78a08cff2e..c602b65cce 100644 --- a/html/includes/jpgraph/src/jpgraph_plotmark.inc.php +++ b/html/lib/jpgraph/jpgraph_plotmark.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_PLOTMARK.PHP // Description: Class file. Handles plotmarks diff --git a/html/includes/jpgraph/src/jpgraph_polar.php b/html/lib/jpgraph/jpgraph_polar.php similarity index 97% rename from html/includes/jpgraph/src/jpgraph_polar.php rename to html/lib/jpgraph/jpgraph_polar.php index af3c88bde9..6d70e6233d 100644 --- a/html/includes/jpgraph/src/jpgraph_polar.php +++ b/html/lib/jpgraph/jpgraph_polar.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_POLAR.PHP // Description: Polar plot extension for JpGraph diff --git a/html/includes/jpgraph/src/jpgraph_radar.php b/html/lib/jpgraph/jpgraph_radar.php similarity index 97% rename from html/includes/jpgraph/src/jpgraph_radar.php rename to html/lib/jpgraph/jpgraph_radar.php index c71ffafe5c..ac9b6338e1 100644 --- a/html/includes/jpgraph/src/jpgraph_radar.php +++ b/html/lib/jpgraph/jpgraph_radar.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_RADAR.PHP // Description: Radar plot extension for JpGraph diff --git a/html/includes/jpgraph/src/jpgraph_regstat.php b/html/lib/jpgraph/jpgraph_regstat.php similarity index 89% rename from html/includes/jpgraph/src/jpgraph_regstat.php rename to html/lib/jpgraph/jpgraph_regstat.php index c327c95985..933123947f 100644 --- a/html/includes/jpgraph/src/jpgraph_regstat.php +++ b/html/lib/jpgraph/jpgraph_regstat.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_REGSTAT.PHP // Description: Regression and statistical analysis helper classes diff --git a/html/includes/jpgraph/src/jpgraph_rgb.inc.php b/html/lib/jpgraph/jpgraph_rgb.inc.php similarity index 96% rename from html/includes/jpgraph/src/jpgraph_rgb.inc.php rename to html/lib/jpgraph/jpgraph_rgb.inc.php index 2cbc85bb31..974e0a300e 100644 --- a/html/includes/jpgraph/src/jpgraph_rgb.inc.php +++ b/html/lib/jpgraph/jpgraph_rgb.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_RGB.INC.PHP // Description: Class to handle RGb color space specification and diff --git a/html/includes/jpgraph/src/jpgraph_scatter.php b/html/lib/jpgraph/jpgraph_scatter.php similarity index 90% rename from html/includes/jpgraph/src/jpgraph_scatter.php rename to html/lib/jpgraph/jpgraph_scatter.php index 141fdfa202..8f7ea1ec92 100644 --- a/html/includes/jpgraph/src/jpgraph_scatter.php +++ b/html/lib/jpgraph/jpgraph_scatter.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_SCATTER.PHP // Description: Scatter (and impuls) plot extension for JpGraph diff --git a/html/includes/jpgraph/src/jpgraph_stock.php b/html/lib/jpgraph/jpgraph_stock.php similarity index 88% rename from html/includes/jpgraph/src/jpgraph_stock.php rename to html/lib/jpgraph/jpgraph_stock.php index 45a136805b..1c257b3c35 100644 --- a/html/includes/jpgraph/src/jpgraph_stock.php +++ b/html/lib/jpgraph/jpgraph_stock.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_STOCK.PHP // Description: Stock plot extension for JpGraph diff --git a/html/includes/jpgraph/src/jpgraph_text.inc.php b/html/lib/jpgraph/jpgraph_text.inc.php similarity index 92% rename from html/includes/jpgraph/src/jpgraph_text.inc.php rename to html/lib/jpgraph/jpgraph_text.inc.php index c93846b858..6de7427e4b 100644 --- a/html/includes/jpgraph/src/jpgraph_text.inc.php +++ b/html/lib/jpgraph/jpgraph_text.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: JPGRAPH_TEXT.INC.PHP // Description: Class to handle text as object in the graph. diff --git a/html/includes/jpgraph/src/jpgraph_ttf.inc.php b/html/lib/jpgraph/jpgraph_ttf.inc.php similarity index 96% rename from html/includes/jpgraph/src/jpgraph_ttf.inc.php rename to html/lib/jpgraph/jpgraph_ttf.inc.php index 1e0d52409c..49e0b5cb2f 100644 --- a/html/includes/jpgraph/src/jpgraph_ttf.inc.php +++ b/html/lib/jpgraph/jpgraph_ttf.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + //======================================================================= // File: jpgraph_ttf.inc.php // Description: Handling of TTF fonts diff --git a/html/includes/jpgraph/src/jpgraph_utils.inc.php b/html/lib/jpgraph/jpgraph_utils.inc.php similarity index 96% rename from html/includes/jpgraph/src/jpgraph_utils.inc.php rename to html/lib/jpgraph/jpgraph_utils.inc.php index bd9fc911de..ca179c7e70 100644 --- a/html/includes/jpgraph/src/jpgraph_utils.inc.php +++ b/html/lib/jpgraph/jpgraph_utils.inc.php @@ -1,4 +1,28 @@ . + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + /*======================================================================= // File: JPGRAPH_UTILS.INC // Description: Collection of non-essential "nice to have" utilities diff --git a/html/includes/jpgraph/src/lang/de.inc.php b/html/lib/jpgraph/lang/de.inc.php similarity index 100% rename from html/includes/jpgraph/src/lang/de.inc.php rename to html/lib/jpgraph/lang/de.inc.php diff --git a/html/includes/jpgraph/src/lang/en.inc.php b/html/lib/jpgraph/lang/en.inc.php similarity index 100% rename from html/includes/jpgraph/src/lang/en.inc.php rename to html/lib/jpgraph/lang/en.inc.php diff --git a/html/includes/jpgraph/src/lang/prod.inc.php b/html/lib/jpgraph/lang/prod.inc.php similarity index 100% rename from html/includes/jpgraph/src/lang/prod.inc.php rename to html/lib/jpgraph/lang/prod.inc.php diff --git a/html/pages/apps/ntp.inc.php b/html/pages/apps/ntp.inc.php new file mode 100644 index 0000000000..d91037775f --- /dev/null +++ b/html/pages/apps/ntp.inc.php @@ -0,0 +1,167 @@ + + * + * 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. + */ + +require_once "../includes/component.php"; +$component = new component(); +$options = array(); +$options['filter']['ignore'] = array('=',0); +$options['type'] = 'ntp'; +$components = $component->getComponents(null,$options); + +print_optionbar_start(); + +$view_options = array( + 'all' => 'All', + 'error' => 'Error', +); +if (!$vars['view']) { + $vars['view'] = 'all'; +} + +$graph_options = array( + 'none' => 'No Graphs', + 'stratum' => 'Stratum', + 'offset' => 'Offset', + 'delay' => 'Delay', + 'dispersion' => 'Dispersion', +); +if (!$vars['graph']) { + $vars['graph'] = 'none'; +} + +echo 'NTP Peers » '; + +// The menu option - on the left +$sep = ''; +foreach ($view_options as $option => $text) { + if (empty($vars['view'])) { + $vars['view'] = $option; + } + echo $sep; + if ($vars['view'] == $option) { + echo ""; + } + echo generate_link($text, $vars, array('view' => $option)); + if ($vars['view'] == $option) { + echo ''; + } + $sep = ' | '; +} + +// The status option - on the right +echo '
'; +$sep = ''; +foreach ($graph_options as $option => $text) { + if (empty($vars['graph'])) { + $vars['graph'] = $option; + } + echo $sep; + if ($vars['graph'] == $option) { + echo ""; + } + + echo generate_link($text, $vars, array('graph' => $option)); + if ($vars['graph'] == $option) { + echo ''; + } + $sep = ' | '; +} +unset($sep); +echo '
'; +print_optionbar_end(); + +?> + + + + + + + + + + $comp) { + $device = device_by_id_cache($devid); + + // Loop through each component + foreach ($comp as $compid => $array) { + $display = true; + if ($vars['view'] == 'error') { + // Only display peers with errors + if ($array['status'] != 2) { + $display = false; + } + } + if ($array['status'] == 2) { + $status = 'class="danger"'; + } else { + $status = ''; + } + + if ($display === true) { + $link = generate_device_link($device,null,array('tab' => 'apps', 'app' => 'ntp')); + $count++; +?> + > + + + + + +'; + echo ''; + echo ''; + } + + } // End if display + } // End foreach component + } // End foreach device + + // If there are no results, let the user know. + if ($count == 0) { +?> + + + + +
DevicePeerStratumError
'; + require 'includes/print-graphrow.inc.php'; + echo '
No Matching NTP Peers
diff --git a/html/pages/availability-map.inc.php b/html/pages/availability-map.inc.php index b5ede4e144..2b86db8361 100644 --- a/html/pages/availability-map.inc.php +++ b/html/pages/availability-map.inc.php @@ -1,6 +1,5 @@ -

Availability Map

-
$text) { $graph_array['id'] = $app['app_id']; if ($key == "ceph_poolstats") { - foreach (glob(rrd_name($device['hostname'], array('app', 'ceph', $app['app_id'], 'pool', '*'))) as $rrd_filename) { + foreach (glob(rrd_name($device['hostname'], array('app', 'ceph', $app['app_id'], 'pool'), '-*.rrd')) as $rrd_filename) { if (preg_match("/.*-pool-(.+)\.rrd$/", $rrd_filename, $pools)) { $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $app['app_id']; @@ -40,7 +40,7 @@ foreach ($graphs as $key => $text) { } } elseif ($key == "ceph_osdperf") { - foreach (glob(rrd_name($device['hostname'], array('app', 'ceph', $app['app_id'], 'osd', '*'))) as $rrd_filename) { + foreach (glob(rrd_name($device['hostname'], array('app', 'ceph', $app['app_id'], 'osd'), '-*.rrd')) as $rrd_filename) { $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $app['app_id']; if (preg_match("/.*-osd-(.+)\.rrd$/", $rrd_filename, $osds)) { @@ -56,7 +56,7 @@ foreach ($graphs as $key => $text) { } } elseif ($key == "ceph_df") { - foreach (glob(rrd_name($device['hostname'], array('app', 'ceph', $app['app_id'], 'df', '*'))) as $rrd_filename) { + foreach (glob(rrd_name($device['hostname'], array('app', 'ceph', $app['app_id'], 'df'), '-*.rrd')) as $rrd_filename) { if (preg_match("/.*-df-(.+)\.rrd$/", $rrd_filename, $pools)) { $pool = $pools[1]; if ($pool == "c") { @@ -86,7 +86,7 @@ foreach ($graphs as $key => $text) { $graph_array['id'] = $app['app_id']; $graph_array['type'] = 'application_ceph_pool_objects'; $graph_array['pool'] = $pool; - + echo ""; include 'includes/print-graphrow.inc.php'; echo ''; diff --git a/html/pages/device/apps/ntp.inc.php b/html/pages/device/apps/ntp.inc.php new file mode 100644 index 0000000000..b7cafed0d0 --- /dev/null +++ b/html/pages/device/apps/ntp.inc.php @@ -0,0 +1,129 @@ + + * + * 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. + */ + +require_once "../includes/component.php"; +$component = new component(); +$options = array(); +$options['filter']['ignore'] = array('=',0); +$options['type'] = 'ntp'; +$components = $component->getComponents($device['device_id'],$options); +$components = $components[$device['device_id']]; + +global $config; +?> + + + + + + + + + + + > + + + + + + +
PeerStratumPeer ReferenceStatus
+ +
+
+

NTP Stratum

+
+
+ +
+
+ +
+
+

Offset

+
+
+ +
+
+ +
+
+

Delay

+
+
+ +
+
+ +
+
+

Dispersion

+
+
+ +
+
diff --git a/html/pages/device/apps/shoutcast.inc.php b/html/pages/device/apps/shoutcast.inc.php index 75f37d99e8..853c0be2e9 100644 --- a/html/pages/device/apps/shoutcast.inc.php +++ b/html/pages/device/apps/shoutcast.inc.php @@ -31,7 +31,7 @@ if (isset($total) && $total === true) { } } -$files = glob(rrd_name($device['hostname'], array('app', 'shoutcast', $app['app_id'], '*'))); +$files = glob(rrd_name($device['hostname'], array('app', 'shoutcast', $app['app_id']), '*.rrd')); foreach ($files as $file) { $pieces = explode('-', basename($file, '.rrd')); $hostname = end($pieces); diff --git a/html/pages/device/apps/unbound.inc.php b/html/pages/device/apps/unbound.inc.php new file mode 100644 index 0000000000..61869c4d2f --- /dev/null +++ b/html/pages/device/apps/unbound.inc.php @@ -0,0 +1,26 @@ + 'Unbound - Queries' + ); +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 '
+
+

'.$text.'

+
+
+
'; + include 'includes/print-graphrow.inc.php'; + echo '
'; + echo '
'; + echo '
'; +} \ No newline at end of file diff --git a/html/pages/device/health/sensors.inc.php b/html/pages/device/health/sensors.inc.php index b8523a4938..dd65e9606f 100644 --- a/html/pages/device/health/sensors.inc.php +++ b/html/pages/device/health/sensors.inc.php @@ -1,7 +1,5 @@ '; - $row = 1; foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `device_id` = ? ORDER BY `sensor_descr`', array($class, $device['device_id'])) as $sensor) { @@ -11,7 +9,14 @@ foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `devi else { $row_colour = $list_colour_b; } - $sensor_descr = $sensor['sensor_descr']; + + if($sensor['poller_type'] == "ipmi") + { + $sensor_descr = ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames); + } else { + $sensor_descr = $sensor['sensor_descr']; + } + $sensor_current = format_si($sensor['sensor_current']).$unit; $sensor_limit = format_si($sensor['sensor_limit']).$unit; $sensor_limit_low = format_si($sensor['sensor_limit_low']).$unit; @@ -30,5 +35,3 @@ foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `devi $row++; } - -//echo ''; diff --git a/html/pages/device/overview/generic/sensor.inc.php b/html/pages/device/overview/generic/sensor.inc.php index 8de67f5c55..d00e9b9773 100644 --- a/html/pages/device/overview/generic/sensor.inc.php +++ b/html/pages/device/overview/generic/sensor.inc.php @@ -1,6 +1,4 @@

'.$device['hostname'].' - '.$sensor['sensor_descr'].'

'; foreach (array('day', 'week', 'month', 'year') as $period) { $graph_array['from'] = $config['time'][$period]; @@ -61,7 +66,6 @@ if (count($sensors)) { $graph_array['from'] = $config['time']['day']; $sensor_minigraph = generate_lazy_graph_tag($graph_array); - $sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 48, ''); if (!empty($state_translation['0']['state_descr'])) { $state_style=""; switch ($state_translation['0']['state_generic_value']) { diff --git a/html/pages/device/showconfig.inc.php b/html/pages/device/showconfig.inc.php index 7ae4bd5a21..a60022461c 100644 --- a/html/pages/device/showconfig.inc.php +++ b/html/pages/device/showconfig.inc.php @@ -1,6 +1,6 @@ + * + * 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. + */ + +$sla = dbFetchRow('SELECT `sla_nr`,`rtt_type` FROM `slas` WHERE `sla_id` = ?', array($vars['id'])); + +?> +
+ +
+ +
+ +
+ +

Average Latency One Way

+
+
+ +
+ +
+

Average Jitter

+
+
+ +
+ +
+

Packet Loss

+
+
+ +
+ +
+

Lost Packets (Out Of Sequence, Tail Drop, Late Arrival)

+
+
+ +
+ +
+

Mean Opinion Score

+
+
+ +
+ +
+

Impairment / Calculated Planning Impairment Factor

+
+
+ +
diff --git a/html/pages/device/sla/rtt.inc.php b/html/pages/device/sla/rtt.inc.php new file mode 100644 index 0000000000..892a2e26f0 --- /dev/null +++ b/html/pages/device/sla/rtt.inc.php @@ -0,0 +1,15 @@ +
+

Round Trip Time

+
+
+ +
diff --git a/html/pages/device/slas.inc.php b/html/pages/device/slas.inc.php index cdab9660fe..7883f417a2 100644 --- a/html/pages/device/slas.inc.php +++ b/html/pages/device/slas.inc.php @@ -2,8 +2,6 @@ print_optionbar_start(); -echo "SLA » "; - $slas = dbFetchRows('SELECT * FROM `slas` WHERE `device_id` = ? AND `deleted` = 0 ORDER BY `sla_nr`', array($device['device_id'])); // Collect types @@ -18,16 +16,23 @@ foreach ($slas as $sla) { if (isset($config['sla_type_labels'][$sla_type])) { $text = $config['sla_type_labels'][$sla_type]; } - } - else { + } else { $text = ucfirst($sla_type); } $sla_types[$sla_type] = $text; } - asort($sla_types); +$status_options = array( + 'all' => 'All', + 'up' => 'Up', + 'down' => 'Down', +); + +echo "SLA » "; + +// SLA Types, on the left. $sep = ''; foreach ($sla_types as $sla_type => $text) { if (!$vars['view']) { @@ -46,7 +51,27 @@ foreach ($sla_types as $sla_type => $text) { $sep = ' | '; } +unset($sep); +// The status option - on the right +echo '
'; +echo "Status » "; +$sep = ''; +foreach ($status_options as $option => $text) { + if (empty($vars['opstatus'])) { + $vars['opstatus'] = $option; + } + echo $sep; + if ($vars['opstatus'] == $option) { + echo ""; + } + + echo generate_link($text, $vars, array('opstatus' => $option)); + if ($vars['opstatus'] == $option) { + echo ''; + } + $sep = ' | '; +} unset($sep); print_optionbar_end(); @@ -56,6 +81,12 @@ foreach ($slas as $sla) { continue; } + $opstatus = ($sla['opstatus'] === '0') ? 'up' : 'down'; + d_echo("
Opstatus :: var: ".$vars['opstatus'].", db: ".$sla['opstatus'].", name: ".$opstatus."
"); + if ($vars['opstatus'] != 'all' && $vars['opstatus'] != $opstatus) { + continue; + } + $name = 'SLA #'.$sla['sla_nr'].' - '.$sla_types[$sla['rtt_type']]; if ($sla['tag']) { $name .= ': '.$sla['tag']; @@ -65,11 +96,30 @@ foreach ($slas as $sla) { $name .= ' (Owner: '.$sla['owner'].')'; } - $graph_array['type'] = 'device_sla'; - $graph_array['id'] = $sla['sla_id']; - echo '
+ // Jitter has more graphs. Display a sub-page + if ($sla['rtt_type'] == 'jitter') { + $name = ' $sla['sla_id'])).'">'.$name.''; + } else { + $name = htmlentities($name); + } + + // If we have an error highlight the row. + if ($sla['opstatus'] == 2) { + $danger = "panel-danger"; + } else { + $danger = ''; + } + + $graph_array = array(); + $graph_array['device'] = $device['device_id']; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['type'] = 'device_sla'; + $graph_array['id'] = $sla['sla_id']; + echo '
-

'.htmlentities($name).'

+

'.$name.'

'; echo "
"; diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 501891abc6..38208af33a 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -714,6 +714,7 @@ $config['poller_modules']['cisco-voice'] = 1; $config['poller_modules']['cisco-cbqos'] = 1; $config['poller_modules']['stp'] = 1; $config['poller_modules']['cisco-otv'] = 1; +$config['poller_modules']['ntp'] = 1; $config['poller_modules']['services'] = 1; // List of discovery modules. Need to be in this array to be @@ -751,6 +752,7 @@ $config['discovery_modules']['charge'] = 1; $config['discovery_modules']['cisco-cbqos'] = 0; $config['discovery_modules']['stp'] = 1; $config['discovery_modules']['cisco-otv'] = 1; +$config['discovery_modules']['ntp'] = 1; $config['modules_compat']['rfc1628']['liebert'] = 1; $config['modules_compat']['rfc1628']['netmanplus'] = 1; diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index db3ea16179..a9f311ea81 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -574,6 +574,21 @@ $config['os'][$os]['over'][4]['graph'] = 'device_ciscowlc_numclients'; $config['os'][$os]['over'][4]['text'] = 'Number of Clients'; $config['os'][$os]['icon'] = 'cisco'; +$os = 'vcs'; +$config['os'][$os]['text'] = 'Video Communication Server'; +$config['os'][$os]['type'] = 'collaboration'; +$config['os'][$os]['icon'] = 'cisco'; + +$os = 'acano'; +$config['os'][$os]['group'] = 'cisco'; +$config['os'][$os]['text'] = 'Acano OS'; +$config['os'][$os]['type'] = 'collaboration'; +$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]['icon'] = 'cisco'; + $os = 'waas'; $config['os'][$os]['group'] = 'cisco'; $config['os'][$os]['text'] = 'Cisco WAAS'; @@ -603,6 +618,22 @@ $config['os'][$os]['text'] = 'TelePresence Codec'; $config['os'][$os]['type'] = 'collaboration'; $config['os'][$os]['icon'] = 'cisco'; +$os = 'ise'; +$config['os'][$os]['text'] = 'Cisco Identity Services Engine'; +$config['os'][$os]['type'] = 'server'; +$config['os'][$os]['icon'] = 'cisco'; +$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'; + +$os = 'tpconductor'; +$config['os'][$os]['text'] = 'TelePresence Conductor'; +$config['os'][$os]['type'] = 'collaboration'; +$config['os'][$os]['icon'] = 'cisco'; + // Brocade NOS $os = 'nos'; $config['os'][$os]['text'] = 'Brocade NOS'; @@ -1803,10 +1834,6 @@ $config['os'][$os]['type'] = 'appliance'; $config['os'][$os]['icon'] = 'hp'; $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'; // HP MSM $os = 'hpmsm'; @@ -1931,8 +1958,17 @@ $config['os'][$os]['over'][1]['text'] = 'Wifi Clients'; $config['os'][$os]['over'][2]['graph'] = 'device_xirrus_rssi'; $config['os'][$os]['over'][2]['text'] = 'Signal RSSI'; - - +// McAfee SIEM +$os = 'nitro'; +$config['os'][$os]['text'] = 'McAfee SIEM Nitro'; +$config['os'][$os]['type'] = 'appliance'; +$config['os'][$os]['icon'] = 'mcafee'; +$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'; // Graph Types require_once $config['install_dir'].'/includes/load_db_graph_types.inc.php'; diff --git a/includes/discovery/cisco-sla.inc.php b/includes/discovery/cisco-sla.inc.php index a5352ffd8a..9f9359c3c7 100644 --- a/includes/discovery/cisco-sla.inc.php +++ b/includes/discovery/cisco-sla.inc.php @@ -43,6 +43,7 @@ if ($config['enable_sla'] && $device['os_group'] == 'cisco') { 'tag' => $sla_config['rttMonCtrlAdminTag'], 'rtt_type' => $sla_config['rttMonCtrlAdminRttType'], 'status' => ($sla_config['rttMonCtrlAdminStatus'] == 'active') ? 1 : 0, + 'opstatus' => ($sla_config['rttMonLatestRttOperSense'] == 'ok') ? 0 : 2, 'deleted' => 0, ); diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index 17dbfe4623..ac7135ab2f 100644 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -157,12 +157,13 @@ if ($device['os'] == 'pbn' && $config['autodiscovery']['xdp'] === true) { $remote_device_id = discover_new_device($lldp['lldpRemSysName'], $device, 'LLDP', $interface); } // normalize MAC address if present - if ($lldp['lldpRemChassisIdSubtype'] == 'macAddress') { - $remote_mac_address = str_replace(array(' ', ':', '-'), '', strtolower($lldp['lldpRemChassisId'])); + $remote_port_mac_address = ''; + if ($lldp['lldpRemPortIdSubtype'] == 'macAddress') { + $remote_port_mac_address = str_replace(array(' ', ':', '-'), '', strtolower($lldp['lldpRemPortId'])); } // get remote device hostname from db by MAC address and replace lldpRemSysName if absent - if (!$remote_device_id && $remote_mac_address) { - $remote_device_id = dbFetchCell('SELECT `device_id` FROM `ports` WHERE ifPhysAddress = ? AND `deleted` = ?', array($remote_mac_address, '0')); + if (!$remote_device_id && $remote_port_mac_address) { + $remote_device_id = dbFetchCell('SELECT `device_id` FROM `ports` WHERE ifPhysAddress = ? AND `deleted` = ?', array($remote_port_mac_address, '0')); if ($remote_device_id) { $remote_device_hostname = dbFetchRow('SELECT `hostname` FROM `devices` WHERE `device_id` = ?', array($remote_device_id)); } @@ -173,7 +174,7 @@ if ($device['os'] == 'pbn' && $config['autodiscovery']['xdp'] === true) { if ($remote_device_id) { $if = $lldp['lldpRemPortDesc']; $id = $lldp['lldpRemPortId']; - $remote_port_id = dbFetchCell('SELECT `port_id` FROM `ports` WHERE (`ifDescr` = ? OR `ifName` = ? OR `ifDescr` = ? OR `ifName` = ? OR `ifPhysAddress` = ?) AND `device_id` = ?', array($if, $if, $id, $id, $remote_mac_address, $remote_device_id)); + $remote_port_id = dbFetchCell('SELECT `port_id` FROM `ports` WHERE (`ifDescr` = ? OR `ifName` = ? OR `ifDescr` = ? OR `ifName` = ? OR `ifPhysAddress` = ?) AND `device_id` = ?', array($if, $if, $id, $id, $remote_port_mac_address, $remote_device_id)); } else { $remote_port_id = '0'; diff --git a/includes/discovery/ntp.inc.php b/includes/discovery/ntp.inc.php new file mode 100644 index 0000000000..60638836ca --- /dev/null +++ b/includes/discovery/ntp.inc.php @@ -0,0 +1,30 @@ + + * + * 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. + * + * This module will display NTP details from various device types. + * To display, modules must store data in for following format: + * Array + * ( + * [UID] => 9093 + * [peer] => 10.0.99.66 + * [port] => 123 + * [stratum] => 4 + * [peerref] => 131.242.253.96 + * [label] => 10.0.99.66:123 + * [status] => 0 + * [error] => + * ) + */ + +if ($device['os_group'] == 'cisco') { + require_once 'includes/discovery/ntp/cisco.inc.php'; +} diff --git a/includes/discovery/ntp/cisco.inc.php b/includes/discovery/ntp/cisco.inc.php new file mode 100644 index 0000000000..1e61110035 --- /dev/null +++ b/includes/discovery/ntp/cisco.inc.php @@ -0,0 +1,131 @@ + + * + * 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. + */ + +$module = 'ntp'; + +require_once 'includes/component.php'; +$component = new component(); +$components = $component->getComponents($device['device_id'],array('type'=>$module)); + +// We only care about our device id. +$components = $components[$device['device_id']]; + +// Begin our master array, all other values will be processed into this array. +$tblComponents = array(); + +// Let's gather some data.. +// For Reference: +// http://www.oidview.com/mibs/9/CISCO-NTP-MIB.html +// http://www.cisco.com/c/en/us/support/docs/availability/high-availability/19643-ntpm.html +$cntpPeersVarEntry = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.168.1.2.1.1', 2); + +/* + * False == no object found - this is not an error, no objects exist + * null == timeout or something else that caused an error, there may be objects but we couldn't get it. + */ +if ( is_null($cntpPeersVarEntry) ) { + // We have to error here or we will end up deleting all our components. + echo "Error\n"; +} else { + // No Error, lets process things. + d_echo("Objects Found:\n"); + + // Let's grab the index for each NTP peer + foreach ($cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][2] as $index => $value) { + $result = array(); + $result['UID'] = (string)$index; // This is cast as a string so it can be compared with the database value. + $result['peer'] = $cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][3][$index]; + $result['port'] = $cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][4][$index]; + $result['stratum'] = $cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][9][$index]; + $result['peerref'] = hex_to_ip($cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][15][$index]); + $result['label'] = $result['peer'].":".$result['port']; + + // Set the status, 16 = Bad + if ($result['stratum'] == 16) { + $result['status'] = 2; + $result['error'] = 'NTP Stratum is Insane'; + } else { + $result['status'] = 0; + $result['error'] = ''; + } + + d_echo("NTP Peer found: "); + d_echo($result); + $tblComponents[] = $result; + } + + /* + * Ok, we have our 2 array's (Components and SNMP) now we need + * to compare and see what needs to be added/updated. + * + * Let's loop over the SNMP data to see if we need to ADD or UPDATE any components. + */ + foreach ($tblComponents as $key => $array) { + $component_key = false; + + // Loop over our components to determine if the component exists, or we need to add it. + foreach ($components as $compid => $child) { + if ($child['UID'] === $array['UID']) { + $component_key = $compid; + } + } + + if (!$component_key) { + // The component doesn't exist, we need to ADD it - ADD. + $new_component = $component->createComponent($device['device_id'],$module); + $component_key = key($new_component); + $components[$component_key] = array_merge($new_component[$component_key], $array); + echo "+"; + } else { + // The component does exist, merge the details in - UPDATE. + $components[$component_key] = array_merge($components[$component_key], $array); + echo "."; + } + + } + + /* + * Loop over the Component data to see if we need to DELETE any components. + */ + foreach ($components as $key => $array) { + // Guilty until proven innocent + $found = false; + + foreach ($tblComponents as $k => $v) { + if ($array['UID'] == $v['UID']) { + // Yay, we found it... + $found = true; + } + } + + if ($found === false) { + // The component has not been found. we should delete it. + echo "-"; + $component->deleteComponent($key); + } + } + + // Write the Components back to the DB. + $component->setComponentPrefs($device['device_id'],$components); + echo "\n"; + +} // End if not error + +$module = strtolower($module); +if (count($components) > 0) { + if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?', array($device['device_id'], $module)) == '0') { + dbInsert(array('device_id' => $device['device_id'], 'app_type' => $module), 'applications'); + } +} else { + dbDelete('applications', '`device_id` = ? AND `app_type` = ?', array($device['device_id'], $module)); +} diff --git a/includes/discovery/os/acano.inc.php b/includes/discovery/os/acano.inc.php new file mode 100644 index 0000000000..9b7986cce4 --- /dev/null +++ b/includes/discovery/os/acano.inc.php @@ -0,0 +1,7 @@ + $value[0], + 'state_descr' => $value[1], + 'state_draw_graph' => $value[2], + 'state_value' => $value[3], + 'state_generic_value' => $value[4] + ); + dbInsert($insert, 'state_translations'); + } + } + } + discover_sensor($valid['sensor'], 'state', $device, $current_oid, $current_id, $fan_state_name, $descr, '1', '1', null, null, null, null, $state, 'snmp', $current_id); + create_sensor_to_state_index($device, $fan_state_name, $current_id); + } + } + + + } + + $psu_oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.16'; + $psu_state_name = 'hpblmos_psustate'; + $psu_state_descr = 'PSU '; + $psu_state_oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.17.'; + + $psus = trim(snmp_walk($device, $psu_oid, '-Osqn')); + + foreach (explode("\n", $psus) as $psu) { + $psu = trim($psu); + if ($psu) { + list($oid, $presence) = explode(' ', $psu, 2); + if ($presence != 2) { + $split_oid = explode('.', $oid); + $current_id = $split_oid[(count($split_oid) - 1)]; + $current_oid = $psu_state_oid.$current_id; + $descr = $psu_state_descr.$current_id; + $state = snmp_get($device, $current_oid, '-Oqv'); + if (!empty($state)) { + $state_index_id = create_state_index($psu_state_name); + if ($state_index_id) { + $states = array( + array($state_index_id, 'other', 0, 1, 3), + array($state_index_id, 'ok', 1, 2, 0), + array($state_index_id, 'degraded', 1, 3, 1), + array($state_index_id, 'failed', 1, 4, 2), + ); + + 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'); + } + } + } + discover_sensor($valid['sensor'], 'state', $device, $current_oid, $current_id, $psu_state_name, $descr, '1', '1', null, null, null, null, $state, 'snmp', $current_id); + create_sensor_to_state_index($device, $psu_state_name, $current_id); + } + } + } +} diff --git a/includes/discovery/sensors/temperatures/hpblmos.inc.php b/includes/discovery/sensors/temperatures/hpblmos.inc.php new file mode 100644 index 0000000000..e5c74fd2b4 --- /dev/null +++ b/includes/discovery/sensors/temperatures/hpblmos.inc.php @@ -0,0 +1,25 @@ + 0) { + discover_sensor($valid['sensor'], 'temperature', $device, $current_oid, $current_id, $sensor_type, $descr, 1, 1, null, null, null, null, $value); + } + } + } + } +} diff --git a/includes/polling/applications/ceph.inc.php b/includes/polling/applications/ceph.inc.php index 5d82639d34..fc29364fa1 100644 --- a/includes/polling/applications/ceph.inc.php +++ b/includes/polling/applications/ceph.inc.php @@ -4,22 +4,23 @@ $name = 'ceph'; if (!empty($agent_data['app'][$name])) { $app_id = $app['app_id']; - foreach (explode('<', $agent_raw) as $section) { + foreach (explode('<', $agent_data['app'][$name]) as $section) { if (empty($section)) continue; list($section, $data) = explode('>', $section); if ($section == "poolstats") { + $rrd_def = array( + 'DS:ops:GAUGE:600:0:U', + 'DS:wrbytes:GAUGE:600:0:U', + 'DS:rbytes:GAUGE:600:0:U' + ); + foreach (explode("\n", $data) as $line) { if (empty($line)) continue; list($pool,$ops,$wrbytes,$rbytes) = explode(':', $line); - $rrd_name = array('app', $name, $app_id, 'pool'.$pool); - $rrd_def = array( - 'DS:ops:GAUGE:600:0:U', - 'DS:wrbytes:GAUGE:600:0:U', - 'DS:rbytes:GAUGE:600:0:U' - ); + $rrd_name = array('app', $name, $app_id, 'pool', $pool); print "Ceph Pool: $pool, IOPS: $ops, Wr bytes: $wrbytes, R bytes: $rbytes\n"; $fields = array( @@ -27,42 +28,43 @@ if (!empty($agent_data['app'][$name])) { 'wrbytes' => $wrbytes, 'rbytes' => $rbytes ); - $tags = compact($name, $app_id, $pool, $rrd_name, $rrd_def); + $tags = compact('name', 'app_id', 'pool', 'rrd_name', 'rrd_def'); data_update($device, 'app', $tags, $fields); } } elseif ($section == "osdperformance") { + $rrd_def = array( + 'DS:apply_ms:GAUGE:600:0:U', + 'DS:commit_ms:GAUGE:600:0:U' + ); + foreach (explode("\n", $data) as $line) { if (empty($line)) continue; list($osd,$apply,$commit) = explode(':', $line); - $rrd_name = array('app', $name, $app_id, 'osd'.$osd); - $rrd_def = array( - 'DS:apply_ms:GAUGE:600:0:U', - 'DS:commit_ms:GAUGE:600:0:U' - ); - + $rrd_name = array('app', $name, $app_id, 'osd', $osd); print "Ceph OSD: $osd, Apply: $apply, Commit: $commit\n"; $fields = array( 'apply_ms' => $apply, 'commit_ms' => $commit ); - $tags = compact($name, $app_id, $osd, $rrd_name, $rrd_def); + $tags = compact('name', 'app_id', 'osd', 'rrd_name', 'rrd_def'); data_update($device, 'app', $tags, $fields); } } elseif ($section == "df") { + $rrd_def = array( + 'DS:avail:GAUGE:600:0:U', + 'DS:used:GAUGE:600:0:U', + 'DS:objects:GAUGE:600:0:U' + ); + foreach (explode("\n", $data) as $line) { if (empty($line)) continue; list($df,$avail,$used,$objects) = explode(':', $line); $rrd_name = array('app', $name, $app_id, 'df', $df); - $rrd_def = array( - 'DS:avail:GAUGE:600:0:U', - 'DS:used:GAUGE:600:0:U', - 'DS:objects:GAUGE:600:0:U' - ); print "Ceph Pool DF: $pool, Avail: $avail, Used: $used, Objects: $objects\n"; $fields = array( @@ -71,7 +73,7 @@ if (!empty($agent_data['app'][$name])) { 'objects' => $objects ); - $tags = compact($name, $app_id, $df, $rrd_name, $rrd_def); + $tags = compact('name', 'app_id', 'df', 'rrd_name', 'rrd_def'); data_update($device, 'app', $tags, $fields); } } diff --git a/includes/polling/applications/proxmox.inc.php b/includes/polling/applications/proxmox.inc.php index 0807c06b51..7f783a3b0c 100644 --- a/includes/polling/applications/proxmox.inc.php +++ b/includes/polling/applications/proxmox.inc.php @@ -1,11 +1,5 @@ >>\n", '', $proxmox); } -dbUpdate(array('device_id' => $device['device_id'], 'app_type' => $name, 'app_instance' => $pmxcluster), 'applications', '`device_id` = ? AND `app_type` = ?', array($device['device_id'], $name)); +if ($proxmox) { + $pmxlines = explode("\n", $proxmox); + $pmxcluster = array_shift($pmxlines); + dbUpdate(array('device_id' => $device['device_id'], 'app_type' => $name, 'app_instance' => $pmxcluster), + 'applications', '`device_id` = ? AND `app_type` = ?', array($device['device_id'], $name)); -if (count($pmxlines) > 0) { - $pmxcache = array(); + if (count($pmxlines) > 0) { + $pmxcache = array(); - foreach ($pmxlines as $vm) { - list($vmid, $vmport, $vmpin, $vmpout, $vmdesc) = explode('/', $vm, 5); - print "Proxmox ($pmxcluster): $vmdesc: $vmpin/$vmpout/$vmport\n"; + foreach ($pmxlines as $vm) { + list($vmid, $vmport, $vmpin, $vmpout, $vmdesc) = explode('/', $vm, 5); + print "Proxmox ($pmxcluster): $vmdesc: $vmpin/$vmpout/$vmport\n"; - $rrd_name = join('/', array($name, $pmxcluster, $vmid)).'_netif_'.$vmport; - $rrd_def = array( - 'DS:INOCTETS:DERIVE:600:0:12500000000', - 'DS:OUTOCTETS:DERIVE:600:0:12500000000' - ); - $fields = array( - 'INOCTETS' => $vmpin, - 'OUTOCTETS' => $vmpout - ); + $rrd_proxmox_name = array( + 'pmxcluster' => $pmxcluster, + 'vmid' => $vmid, + 'vmport' => $vmport + ); + $rrd_def = array( + 'DS:INOCTETS:DERIVE:600:0:12500000000', + 'DS:OUTOCTETS:DERIVE:600:0:12500000000' + ); + $fields = array( + 'INOCTETS' => $vmpin, + 'OUTOCTETS' => $vmpout + ); - $tags = compact('name', 'app_id', 'pmxcluster', 'vmid', 'vmport', 'rrd_name', 'rrd_def'); - data_update($device, 'app', $tags, $fields); + $tags = compact('name', 'app_id', 'pmxcluster', 'vmid', 'vmport', 'rrd_proxmox_name', 'rrd_def'); + data_update($device, 'app', $tags, $fields); - if (proxmox_vm_exists($vmid, $pmxcluster, $pmxcache) === true) { - dbUpdate(array('device_id' => $device['device_id'], 'last_seen' => array('NOW()'), 'description' => $vmdesc), $name, '`vmid` = ? AND `cluster` = ?', array($vmid, $pmxcluster)); + if (proxmox_vm_exists($vmid, $pmxcluster, $pmxcache) === true) { + dbUpdate(array( + 'device_id' => $device['device_id'], + 'last_seen' => array('NOW()'), + 'description' => $vmdesc + ), $name, '`vmid` = ? AND `cluster` = ?', array($vmid, $pmxcluster)); + } else { + $pmxcache[$pmxcluster][$vmid] = dbInsert(array( + 'cluster' => $pmxcluster, + 'vmid' => $vmid, + 'description' => $vmdesc, + 'device_id' => $device['device_id'] + ), $name); + } + + if ($portid = proxmox_port_exists($vmid, $pmxcluster, $vmport) !== false) { + dbUpdate(array('last_seen' => array('NOW()')), 'proxmox_ports', '`vm_id` = ? AND `port` = ?', + array($pmxcache[$pmxcluster][$vmid], $vmport)); + } else { + dbInsert(array('vm_id' => $pmxcache[$pmxcluster][$vmid], 'port' => $vmport), 'proxmox_ports'); + } } - else { - $pmxcache[$pmxcluster][$vmid] = dbInsert(array('cluster' => $pmxcluster, 'vmid' => $vmid, 'description' => $vmdesc, 'device_id' => $device['device_id']), $name); - } - - if ($portid = proxmox_port_exists($vmid, $pmxcluster, $vmport) !== false) { - dbUpdate(array('last_seen' => array('NOW()')), 'proxmox_ports', '`vm_id` = ? AND `port` = ?', array($pmxcache[$pmxcluster][$vmid], $vmport)); - } - else { - dbInsert(array('vm_id' => $pmxcache[$pmxcluster][$vmid], 'port' => $vmport), 'proxmox_ports'); - } - } } - -unset($pmxlines); -unset($pmxcluster); -unset($pmxcdir); -unset($proxmox); -unset($pmxcache); +unset($pmxlines, $pmxcluster, $pmxcdir, $proxmox, $pmxcache); diff --git a/includes/polling/applications/unbound.inc.php b/includes/polling/applications/unbound.inc.php new file mode 100644 index 0000000000..ebb044ae16 --- /dev/null +++ b/includes/polling/applications/unbound.inc.php @@ -0,0 +1,61 @@ + $unbound['num.query.type.TYPE0'], + 'a' => $unbound['num.query.type.A'], + 'ns' => $unbound['num.query.type.NS'], + 'cname' => $unbound['num.query.type.CNAME'], + 'soa' => $unbound['num.query.type.SOA'], + 'null' => $unbound['num.query.type.NULL'], + 'wks' => $unbound['num.query.type.WKS'], + 'ptr' => $unbound['num.query.type.PTR'], + 'mx' => $unbound['num.query.type.MX'], + 'txt' => $unbound['num.query.type.TXT'], + 'aaaa' => $unbound['num.query.type.AAAA'], + 'srv' => $unbound['num.query.type.SRV'], + 'naptr' => $unbound['num.query.type.NAPTR'], + 'ds' => $unbound['num.query.type.DS'], + 'dnskey' => $unbound['num.query.type.DNSKEY'], + 'spf' => $unbound['num.query.type.SPF'], + 'any' => $unbound['num.query.type.ANY'], + 'other' => $unbound['num.query.type.other'] + ); +$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def'); +data_update($device, 'app', $tags, $fields); +unset($lines , $unbound, $rrd_name, $rrd_def, $fields, $tags); \ No newline at end of file diff --git a/includes/polling/cisco-sla.inc.php b/includes/polling/cisco-sla.inc.php index a9e315f385..91588c590d 100644 --- a/includes/polling/cisco-sla.inc.php +++ b/includes/polling/cisco-sla.inc.php @@ -1,61 +1,95 @@ 0)) { + // We have SLA's, lets go!!! -$sla_table = array(); -foreach (explode("\n", $slavals) as $sla) { - $key_val = explode(' ', $sla, 2); - if (count($key_val) != 2) { - $key_val[] = ''; + // Go get some data from the device. + $rttMonLatestRttOperTable = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.42.1.2.10.1', 1); + $rttMonLatestOper = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.42.1.5', 1); + + $uptime = snmp_get($device, 'sysUpTime.0', '-Otv'); + $time_offset = (time() - intval($uptime) / 100); + + foreach ($slas as $sla) { + $sla_nr = $sla['sla_nr']; + $rtt_type = $sla['rtt_type']; + + // Lets process each SLA + $unixtime = intval(($rttMonLatestRttOperTable['1.3.6.1.4.1.9.9.42.1.2.10.1.5'][$sla_nr] / 100 + $time_offset)); + $time = strftime('%Y-%m-%d %H:%M:%S', $unixtime); + $update = array(); + + // Use Nagios Status codes. + $opstatus = $rttMonLatestRttOperTable['1.3.6.1.4.1.9.9.42.1.2.10.1.2'][$sla_nr]; + if ($opstatus == 1) { + $opstatus = 0; // 0=Good + } else { + $opstatus = 2; // 2=Critical + } + + // Populating the update array means we need to update the DB. + if ($opstatus != $sla['opstatus']) { + $update['opstatus'] = $opstatus; + } + + $rtt = $rttMonLatestRttOperTable['1.3.6.1.4.1.9.9.42.1.2.10.1.1'][$sla_nr]; + echo 'SLA '.$sla_nr.': '.$rtt_type.' '.$sla['owner'].' '.$sla['tag'].'... '.$rtt.'ms at '.$time.'\n'; + + $fields = array( + 'rtt' => $rtt, + ); + + // The base RRD + $rrd_name = array('sla', $sla_nr); + $rrd_def = 'DS:rtt:GAUGE:600:0:300000'; + $tags = compact('sla_nr', 'rrd_name', 'rrd_def'); + data_update($device,'sla',$tags,$fields); + + // Let's gather some per-type metrics. + switch ($rtt_type) { + case 'jitter': + $jitter = array( + 'PacketLossSD' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.2.1.26'][$sla_nr], + 'PacketLossDS' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.2.1.27'][$sla_nr], + 'PacketOutOfSequence' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.2.1.28'][$sla_nr], + 'PacketMIA' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.2.1.29'][$sla_nr], + 'PacketLateArrival' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.2.1.30'][$sla_nr], + 'MOS' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.2.1.42'][$sla_nr]/100, + 'ICPIF' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.2.1.43'][$sla_nr], + 'OWAvgSD' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.2.1.49'][$sla_nr], + 'OWAvgDS' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.2.1.50'][$sla_nr], + 'AvgSDJ' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.2.1.47'][$sla_nr], + 'AvgDSJ' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.2.1.48'][$sla_nr], + ); + $rrd_name = array('sla', $sla_nr, $rtt_type); + $rrd_def = array( + 'DS:PacketLossSD:GAUGE:600:0:U', + 'DS:PacketLossDS:GAUGE:600:0:U', + 'DS:PacketOutOfSequence:GAUGE:600:0:U', + 'DS:PacketMIA:GAUGE:600:0:U', + 'DS:PacketLateArrival:GAUGE:600:0:U', + 'DS:MOS:GAUGE:600:0:U', + 'DS:ICPIF:GAUGE:600:0:U', + 'DS:OWAvgSD:GAUGE:600:0:U', + 'DS:OWAvgDS:GAUGE:600:0:U', + 'DS:AvgSDJ:GAUGE:600:0:U', + 'DS:AvgDSJ:GAUGE:600:0:U', + ); + $tags = compact('rrd_name', 'rrd_def', 'sla_nr', 'rtt_type'); + data_update($device,'sla',$tags,$jitter); + $metrics = array_merge($metrics,$jitter); + break; + } + + d_echo("The following metrics were collected for #".$sla['sla_nr'].":\n"); + d_echo($metrics); + + // Update the DB if necessary + if (count($update) > 0) { + $updated = dbUpdate($update, 'slas', '`sla_id` = ?', array($sla['sla_id'])); + } } - - $key = $key_val[0]; - $value = $key_val[1]; - - $prop_id = explode('.', $key); - if ((count($prop_id) != 2) || !ctype_digit($prop_id[1])) { - continue; - } - - $property = str_replace('rttMonLatestRttOper', '', $prop_id[0]); - $id = intval($prop_id[1]); - - $sla_table[$id][$property] = trim($value); } - -// Update timestamps -foreach ($sla_table as &$sla) { - $sla['UnixTime'] = intval(($sla['Time'] / 100 + $time_offset)); - $sla['TimeStr'] = strftime('%Y-%m-%d %H:%M:%S', $sla['UnixTime']); -} - -unset($sla); - -foreach (dbFetchRows('SELECT * FROM `slas` WHERE `device_id` = ? AND `deleted` = 0 AND `status` = 1', array($device['device_id'])) as $sla) { - $sla_nr = $sla['sla_nr']; - echo 'SLA '. $sla_nr .': '.$sla['rtt_type'].' '.$sla['owner'].' '.$sla['tag'].'... '; - - if (isset($sla_table[$sla_nr])) { - $slaval = $sla_table[$sla_nr]; - echo $slaval['CompletionTime'].'ms at '.$slaval['TimeStr']; - $val = $slaval['CompletionTime']; - } - else { - echo 'NaN'; - $val = 'U'; - } - - $rrd_name = array('sla', $sla_nr); - $rrd_def = 'DS:rtt:GAUGE:600:0:300000'; - $fields = array( - 'rtt' => $val, - ); - - $tags = compact('sla_nr', 'rrd_name', 'rrd_def'); - data_update($device,'sla',$tags,$fields); - - echo "\n"; -}//end foreach diff --git a/includes/polling/ntp.inc.php b/includes/polling/ntp.inc.php new file mode 100644 index 0000000000..9a1a552384 --- /dev/null +++ b/includes/polling/ntp.inc.php @@ -0,0 +1,23 @@ + + * + * 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. + * + * This module will display NTP details from various device types. + * To display, modules must create rrd's named: ntp-%PEER%.rrd with the following DS': + * DS:stratum:GAUGE:600:0:U + * DS:offset:GAUGE:600:0:U + * DS:delay:GAUGE:600:0:U + * DS:dispersion:GAUGE:600:0:U + */ + +if ($device['os_group'] == 'cisco') { + require_once 'includes/polling/ntp/cisco.inc.php'; +} diff --git a/includes/polling/ntp/cisco.inc.php b/includes/polling/ntp/cisco.inc.php new file mode 100644 index 0000000000..4eab7c4f39 --- /dev/null +++ b/includes/polling/ntp/cisco.inc.php @@ -0,0 +1,82 @@ + + * + * 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. + */ + +$module = 'ntp'; + +require_once 'includes/component.php'; +$component = new component(); +$options = array(); +$options['filter']['type'] = array('=',$module); +$options['filter']['disabled'] = array('=',0); +$options['filter']['ignore'] = array('=',0); +$components = $component->getComponents($device['device_id'],$options); + +// We only care about our device id. +$components = $components[$device['device_id']]; + +// Only collect SNMP data if we have enabled components +if (count($components > 0)) { + // Let's gather the stats.. + $cntpPeersVarEntry = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.168.1.2.1.1', 2); + + // Loop through the components and extract the data. + foreach ($components as $key => &$array) { + $peer = $array['peer']; + + // Let's make sure the rrd is setup for this class. + $rrd_name = array('ntp', $peer); + $rrd_def = array( + 'DS:stratum:GAUGE:600:0:U', + 'DS:offset:GAUGE:600:0:U', + 'DS:delay:GAUGE:600:0:U', + 'DS:dispersion:GAUGE:600:0:U', + ); + + $array['stratum'] = $cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][9][$array['UID']]; + // Set the status, 16 = Bad + if ($array['stratum'] == 16) { + $array['status'] = 2; + $array['error'] = 'NTP Stratum is Insane'; + } else { + $array['status'] = 0; + $array['error'] = ''; + } + + // Extract the statistics and update rrd + $rrd['stratum'] = $array['stratum']; + $rrd['offset'] = hexdec($cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][23][$array['UID']]); + $rrd['delay'] = hexdec($cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][24][$array['UID']]); + $rrd['dispersion'] = hexdec($cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][25][$array['UID']]); + $tags = compact('ntp', 'rrd_name', 'rrd_def', 'peer'); + data_update($device, 'ntp', $tags, $rrd); + + // Let's print some debugging info. + d_echo("\n\nComponent: ".$key."\n"); + d_echo(" Index: ".$array['UID']."\n"); + d_echo(" Peer: ".$array['peer'].":".$array['port']."\n"); + d_echo(" Stratum: 1.3.6.1.4.1.9.9.168.1.2.1.1.9.".$array['UID']." = ".$rrd['stratum']."\n"); + d_echo(" Offset: 1.3.6.1.4.1.9.9.168.1.2.1.1.23.".$array['UID']." = ".$rrd['offset']."\n"); + d_echo(" Delay: 1.3.6.1.4.1.9.9.168.1.2.1.1.24.".$array['UID']." = ".$rrd['delay']."\n"); + d_echo(" Dispersion: 1.3.6.1.4.1.9.9.168.1.2.1.1.25.".$array['UID']." = ".$rrd['dispersion']."\n"); + + // Clean-up after yourself! + unset($filename, $rrd_filename, $rrd); + } // End foreach components + + // Write the Components back to the DB. + $component->setComponentPrefs($device['device_id'],$components); + +} // end if count components + +// Clean-up after yourself! +unset($type, $components, $component, $options, $module); diff --git a/includes/polling/os/acano.inc.php b/includes/polling/os/acano.inc.php new file mode 100644 index 0000000000..b61d68f7f0 --- /dev/null +++ b/includes/polling/os/acano.inc.php @@ -0,0 +1,7 @@ + array( + "Temp 1" => "Ambient zone", + "Temp 2" => "CPU 1", + "Temp 3" => "CPU 2", + "Temp 4" => "Memory zone", + "Temp 5" => "Memory zone", + "Temp 6" => "Memory zone", + "Temp 7" => "System zone", + "Temp 8" => "System zone", + "Temp 9" => "System zone", + "Temp 10" => "Storage zone", + "Power Meter" => "Power usage", + ), + "HP ProLiant BL460c G1" => array( + "Temp 1" => "System zone", + "Temp 2" => "CPU 1 zone", + "Temp 3" => "CPU 1", + "Temp 4" => "CPU 1", + "Temp 5" => "CPU 2 zone", + "Temp 6" => "CPU 2", + "Temp 7" => "CPU 2", + "Temp 8" => "Memory zone", + "Temp 9" => "Ambient zone", + "Power Meter" => "Power usage", + ), +); diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index 6030782052..04794c9af1 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -151,7 +151,7 @@ function rrdtool_graph($graph_file, $options) */ function rrdtool($command, $filename, $options, $timeout = 0) { - global $config, $debug, $rrd_pipes, $console_color; + global $config, $vdebug, $rrd_pipes, $console_color; // do not ovewrite files when creating if ($command == 'create') { @@ -173,12 +173,20 @@ function rrdtool($command, $filename, $options, $timeout = 0) $cmd = "$command $filename $options"; } + d_echo($console_color->convert('RRD[%g'.$cmd."%n] \n")); + // do not write rrd files, but allow read-only commands if ($config['norrd'] && !in_array($command, array('graph', 'graphv', 'dump', 'fetch', 'first', 'last', 'lastupdate', 'info', 'xport')) ) { print $console_color->convert('[%rRRD Disabled%n]'); $output = array(null, null); + } elseif ($command == 'create' && + version_compare($config['rrdtool_version'], '1.5', '<') && + is_file($filename) + ) { // do not ovewrite RRD if already exist and RRDTool ver. < 1.5 + d_echo($console_color->convert('RRD[%g' . $filename . " already exists%n]\n")); + $output = array(null, null); } else { if ($timeout > 0 && stream_select($r = $rrd_pipes, $w = null, $x = null, 0)) { // dump existing data @@ -192,8 +200,7 @@ function rrdtool($command, $filename, $options, $timeout = 0) $output = array(stream_get_contents($rrd_pipes[1]), stream_get_contents($rrd_pipes[2])); } - if ($debug) { - print $console_color->convert('RRD[%g'.$cmd."%n] \n"); + if ($vdebug) { echo 'RRDtool Output: '; echo $output[0]; echo $output[1]; @@ -204,20 +211,14 @@ function rrdtool($command, $filename, $options, $timeout = 0) /** * Checks if the rrd file exists on the server - * This will perform a remote check if using rrdcached and rrdtool >= 1.5 + * This will perform a remote check if using rrdcached and rrdtool >= 1.5 (broken) * * @param $filename * @return bool */ function rrdtool_check_rrd_exists($filename) { - global $config; - if ($config['rrdcached'] && version_compare($config['rrdtool_version'], '1.5', '>=')) { - $chk = rrdtool('last', $filename, '', 30); // wait up to 30 seconds - return strpos(implode($chk), "$filename': No such file or directory") === false; - } else { - return is_file($filename); - } + return is_file($filename); } /** @@ -292,6 +293,26 @@ function rrd_name($host, $extra, $extension = ".rrd") return implode("/", array($config['rrd_dir'], $host, $filename.$extension)); } // rrd_name +/** + * Generates a filename for a proxmox cluster rrd + * + * @param $pmxcluster + * @param $vmid + * @param $vmport + * @return string full path to the rrd. + */ +function proxmox_rrd_name($pmxcluster, $vmid, $vmport) { + global $config; + + $pmxcdir = join('/', array($config['rrd_dir'], 'proxmox', safename($pmxcluster))); + // this is not needed for remote rrdcached + if (!is_dir($pmxcdir)) { + mkdir($pmxcdir, 0775, true); + } + + return join('/', array($pmxcdir, safename($vmid.'_netif_'.$vmport.'.rrd'))); +} + /** * Modify an rrd file's max value and trim the peaks as defined by rrdtool * @@ -358,7 +379,13 @@ function rrdtool_data_update($device, $measurement, $tags, $fields) rrd_file_rename($device, $oldname, $rrd_name); } - $rrd = rrd_name($device['hostname'], $rrd_name); + if (isset($tags['rrd_proxmox_name'])) { + $pmxvars = $tags['rrd_proxmox_name']; + $rrd = proxmox_rrd_name($pmxvars['pmxcluster'], $pmxvars['vmid'], $pmxvars['vmport']); + } else { + $rrd = rrd_name($device['hostname'], $rrd_name); + } + if ($tags['rrd_def']) { $rrd_def = is_array($tags['rrd_def']) ? $tags['rrd_def'] : array($tags['rrd_def']); // add the --step and the rra definitions to the command diff --git a/poller.php b/poller.php index 36ee777a04..78254d8192 100755 --- a/poller.php +++ b/poller.php @@ -84,7 +84,7 @@ if (!$where) { echo "-r Do not create or update RRDs\n"; echo "-f Do not insert data into InfluxDB\n"; echo "-d Enable debugging output\n"; - echo "-d Enable verbose debugging output\n"; + echo "-v Enable verbose debugging output\n"; echo "-m Specify module(s) to be run\n"; echo "\n"; echo "No polling type specified!\n"; diff --git a/snmp-scan.php b/snmp-scan.php index fb864f9492..887ae06389 100755 --- a/snmp-scan.php +++ b/snmp-scan.php @@ -42,7 +42,7 @@ require 'includes/functions.php'; require 'includes/discovery/functions.inc.php'; function perform_snmp_scan($net) { - global $stats, $config, $debug; + global $stats, $config, $debug, $vdebug; echo 'Range: '.$net->network.'/'.$net->bitmask.PHP_EOL; $config['snmp']['timeout'] = 1; $config['snmp']['retries'] = 0; @@ -52,6 +52,10 @@ function perform_snmp_scan($net) { while ($start++ < $end) { $stats['count']++; $host = long2ip($start); + if (match_network($config['autodiscovery']['nets-exclude'], $host)) { + echo '|'; + continue; + } $test = isPingable($host); if ($test['result'] === false) { echo '.'; @@ -93,7 +97,7 @@ function perform_snmp_scan($net) { echo PHP_EOL; } -$opts = getopt('r:d::l::h::'); +$opts = getopt('r:d::v::l::h::'); $stats = array('count'=> 0, 'known'=>0, 'added'=>0, 'failed'=>0); $start = false; $debug = false; @@ -106,15 +110,19 @@ if (isset($opts['h']) || (empty($opts) && (!isset($config['nets']) || empty($con echo ' This argument is only requied if $config[\'nets\'] is not set'.PHP_EOL; echo ' Example: 192.168.0.0/24'.PHP_EOL; echo ' -d Enable Debug'.PHP_EOL; + echo ' -v Enable verbose Debug'.PHP_EOL; echo ' -l Show Legend'.PHP_EOL; echo ' -h Print this text'.PHP_EOL; exit(0); } -if (isset($opts['d'])) { +if (isset($opts['d']) || isset($opts['v'])) { + if (isset($opts['v'])) { + $vdebug = true; + } $debug = true; } if (isset($opts['l'])) { - echo ' * = Known Device; . = Unpingable Device; + = Added Device; - = Failed To Add Device;'.PHP_EOL; + echo ' * = Known Device; . = Unpingable Device; + = Added Device; - = Failed To Add Device; | = Excluded by config.php'.PHP_EOL; } if (isset($opts['r'])) { $net = Net_IPv4::parseAddress($opts['r']); diff --git a/sql-schema/127.sql b/sql-schema/127.sql new file mode 100644 index 0000000000..902091df86 --- /dev/null +++ b/sql-schema/127.sql @@ -0,0 +1 @@ +ALTER TABLE `slas` ADD `opstatus` TINYINT(1) NOT NULL DEFAULT '0' AFTER `status`;