From c0125f28e408d3410b48205258c8aa0ba70da5d6 Mon Sep 17 00:00:00 2001 From: laf Date: Sun, 23 Aug 2015 19:36:22 +0000 Subject: [PATCH 01/40] Added support for rrdtool 1.5 --- doc/Extensions/Distributed-Poller.md | 21 +++++++++++++++++++-- doc/Extensions/RRDCached.md | 15 +++++++++++---- includes/defaults.inc.php | 1 + includes/rrdtool.inc.php | 16 ++-------------- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/doc/Extensions/Distributed-Poller.md b/doc/Extensions/Distributed-Poller.md index 86163b644..e6c3e2c9d 100644 --- a/doc/Extensions/Distributed-Poller.md +++ b/doc/Extensions/Distributed-Poller.md @@ -5,7 +5,11 @@ These machines can be in a different physical location and therefore minimize ne Devices can also be groupped together into a `poller_group` to pin these devices to a single or a group of designated pollers. -All pollers need to share their RRD-folder, for example via NFS or a combination of NFS and rrdcached. +~~All pollers need to share their RRD-folder, for example via NFS or a combination of NFS and rrdcached.~~ + +> This is no longer a strict requirement with the use of rrdtool 1.5 and above. If you are NOT running 1.5 then you will still +need to share the RRD-folder. + It is also required that all pollers can access the central memcached to communicate with eachother. In order to enable distributed polling, set `$config['distributed_poller'] = true` and your memcached details into `$config['distributed_poller_memcached_host']` and `$config['distributed_poller_memcached_port']`. @@ -49,7 +53,14 @@ The pollers, web and API layers should all be able to access the database server ####RRD Storage Central storage should be provided so all RRD files can be read from and written to in one location. As suggested above, it's recommended that RRD Cached is configured and used. -For this example, we are running RRDCached to allow all pollers and web/api servers to read/write to the rrd iles with the rrd directory also exported by NFS for simple access and maintenance. +For this example, we are running RRDCached to allow all pollers and web/api servers to read/write to the rrd iles ~~with the rrd directory also exported by NFS for simple access and maintenance.~~ + +Sharing rrd files via something like NFS is no longer required if you run rrdtool 1.5 or greater. If you don't - please share your rrd folder as before. If you run rrdtool +1.5 or greater then add this config to your pollers: + +```php +$config['rrdtool_version'] = 1.5; +``` ####Memcache Memcache is required for the distributed pollers to be able to register to a central location and record what devices are polled. Memcache can run from any of the kit so long as it is accessable by all pollers. @@ -88,4 +99,10 @@ $config['rrd_dir'] = "/opt/librenms/rrd"; $config['rrdcached_dir'] = ""; ``` +For rrdtool 1.5 or greater then you can enable support for rrdcached to create the rrd files: + +```php +$config['rrdtool_version'] = 1.5; +``` + $config['rrdcached_dir'] Is only needed if you are using tcp connections for rrd cached and needs only to be set if you want to store rrd files within a sub directory of your rrdcached base directory. diff --git a/doc/Extensions/RRDCached.md b/doc/Extensions/RRDCached.md index 27a157c5d..1459235c6 100644 --- a/doc/Extensions/RRDCached.md +++ b/doc/Extensions/RRDCached.md @@ -6,19 +6,19 @@ This document will explain how to setup RRDCached for LibreNMS. This example is based on a fresh LibreNMS install, on a minimimal CentOS installation. In this example, we'll use the Repoforge repository. -```ssh +```php rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm vi /etc/yum.repos.d/rpmforge.repo ``` - Enable the Extra repo -```ssh +```php yum update rrdtool vi /etc/yum.repos.d/rpmforge.repo ``` - Disable the [rpmforge] and [rpmforge-extras] repos again -```ssh +```php vi /etc/sysconfig/rrdcached # Settings for rrdcached @@ -34,6 +34,13 @@ service rrdcached start ``` Edit config.php to include: -```ssh +```php $config['rrdcached'] = "unix:/var/run/rrdcached/rrdcached.sock"; ``` + +> If you are using rrdtool / rrdcached version 1.5 or above then this now supports creating rrd files over rrdcached. To +enable this set the following config: + +```php +$config['rrdtool_version'] = 1.5; +``` diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 66ca1fcea..9f370381a 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -51,6 +51,7 @@ $config['own_hostname'] = 'localhost'; // Location of executables $config['rrdtool'] = '/usr/bin/rrdtool'; +$config['rrdtool_version'] = 1.4; // Doesn't need to contain minor numbers. $config['fping'] = '/usr/bin/fping'; $config['fping_options']['retries'] = 3; $config['fping_options']['timeout'] = 500; diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index a8a7e9936..3e09d523b 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -166,7 +166,7 @@ function rrdtool_graph($graph_file, $options) { function rrdtool($command, $filename, $options) { global $config, $debug, $rrd_pipes, $console_color; - if ($command != 'create' && $config['rrdcached']) { + if ($config['rrdtool_version'] >= 1.5 && $config['rrdcached']) { if (isset($config['rrdcached_dir']) && $config['rrdcached_dir'] !== false) { $filename = str_replace($config['rrd_dir'].'/', './'.$config['rrdcached_dir'].'/', $filename); $filename = str_replace($config['rrd_dir'], './'.$config['rrdcached_dir'].'/', $filename); @@ -206,19 +206,7 @@ function rrdtool($command, $filename, $options) { function rrdtool_create($filename, $options) { - global $config, $console_color; - - if ($config['norrd']) { - print $console_color->convert('[%gRRD Disabled%n] ', false); - } - else { - $command = $config['rrdtool']." create $filename $options"; - } - - d_echo($console_color->convert('RRD[%g'.$command.'%n] ')); - - return shell_exec($command); - + return rrdtool('create', $filename, $options); } From 4d9163c9ecc964d1a8536ab44f931b4de0a2c052 Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 24 Aug 2015 19:14:30 +0000 Subject: [PATCH 02/40] Make network graphs compatible with 1.4.x and 1.5.x rrdtool --- html/includes/graphs/generic_multi_seperated.inc.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/html/includes/graphs/generic_multi_seperated.inc.php b/html/includes/graphs/generic_multi_seperated.inc.php index ce0a9472b..9b37f3751 100644 --- a/html/includes/graphs/generic_multi_seperated.inc.php +++ b/html/includes/graphs/generic_multi_seperated.inc.php @@ -74,7 +74,7 @@ foreach ($rrd_list as $rrd) { $stack = 'STACK'; } - $rrd_options .= ' AREA:inbits'.$i.'#'.$colour_in.":'".rrdtool_escape($rrd['descr'], 9)."In ':$stack"; + $rrd_options .= ' AREA:inbits'.$i.'#'.$colour_in.":'".rrdtool_escape($rrd['descr'], 9)."In '$stack"; $rrd_options .= ' GPRINT:inbits'.$i.':LAST:%6.2lf%s'; $rrd_options .= ' GPRINT:inbits'.$i.':AVERAGE:%6.2lf%s'; $rrd_options .= ' GPRINT:inbits'.$i.':MAX:%6.2lf%s'; @@ -84,8 +84,8 @@ foreach ($rrd_list as $rrd) { } $rrd_options .= " COMMENT:'\\n'"; - $rrd_optionsb .= ' AREA:outbits'.$i.'_neg#'.$colour_out."::$stack"; - $rrd_options .= ' HRULE:999999999999999#'.$colour_out.":'".str_pad('', 10)."Out':"; + $rrd_optionsb .= ' AREA:outbits'.$i.'_neg#'.$colour_out.":$stack"; + $rrd_options .= ' HRULE:999999999999999#'.$colour_out.":'".str_pad('', 10)."Out'"; $rrd_options .= ' GPRINT:outbits'.$i.':LAST:%6.2lf%s'; $rrd_options .= ' GPRINT:outbits'.$i.':AVERAGE:%6.2lf%s'; $rrd_options .= ' GPRINT:outbits'.$i.':MAX:%6.2lf%s'; @@ -141,21 +141,21 @@ if (!$args['nototal']) { $rrd_options .= " COMMENT:' \\n'"; - $rrd_options .= " HRULE:999999999999999#FFFFFF:'".str_pad('Total', 10)."In ':"; + $rrd_options .= " HRULE:999999999999999#FFFFFF:'".str_pad('Total', 10)."In '"; $rrd_options .= ' GPRINT:inbits:LAST:%6.2lf%s'; $rrd_options .= ' GPRINT:inbits:AVERAGE:%6.2lf%s'; $rrd_options .= ' GPRINT:inbits:MAX:%6.2lf%s'; $rrd_options .= " GPRINT:totin:%6.2lf%s$total_units"; $rrd_options .= " COMMENT:'\\n'"; - $rrd_options .= " HRULE:999999999999990#FFFFFF:'".str_pad('', 10)."Out':"; + $rrd_options .= " HRULE:999999999999990#FFFFFF:'".str_pad('', 10)."Out'"; $rrd_options .= ' GPRINT:outbits:LAST:%6.2lf%s'; $rrd_options .= ' GPRINT:outbits:AVERAGE:%6.2lf%s'; $rrd_options .= ' GPRINT:outbits:MAX:%6.2lf%s'; $rrd_options .= " GPRINT:totout:%6.2lf%s$total_units"; $rrd_options .= " COMMENT:'\\n'"; - $rrd_options .= " HRULE:999999999999990#FFFFFF:'".str_pad('', 10)."Agg':"; + $rrd_options .= " HRULE:999999999999990#FFFFFF:'".str_pad('', 10)."Agg'"; $rrd_options .= ' GPRINT:bits:LAST:%6.2lf%s'; $rrd_options .= ' GPRINT:bits:AVERAGE:%6.2lf%s'; $rrd_options .= ' GPRINT:bits:MAX:%6.2lf%s'; From ac001191dc17b5304421931bbf16427c750c788b Mon Sep 17 00:00:00 2001 From: Nils Steinger Date: Tue, 22 Sep 2015 02:25:35 +0200 Subject: [PATCH 03/40] Use fping6 instead of fping for hosts with udp6/tcp6 SNMP transports --- includes/defaults.inc.php | 1 + includes/functions.php | 32 ++++++++++++++++++++++++------ includes/polling/functions.inc.php | 4 +++- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 21057ea49..9236ef353 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -52,6 +52,7 @@ $config['own_hostname'] = 'localhost'; // Location of executables $config['rrdtool'] = '/usr/bin/rrdtool'; $config['fping'] = '/usr/bin/fping'; +$config['fping6'] = '/usr/bin/fping6'; $config['fping_options']['retries'] = 3; $config['fping_options']['timeout'] = 500; $config['fping_options']['count'] = 3; diff --git a/includes/functions.php b/includes/functions.php index 84e95af1d..a98b5bfd3 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -275,7 +275,8 @@ function addHost($host, $snmpver, $port = '161', $transport = 'udp', $quiet = '0 } if (ip_exists($ip) === false) { // Test reachability - if ($force_add == 1 || isPingable($host)) { + $address_family = snmpTransportToAddressFamily($transport); + if ($force_add == 1 || isPingable($host, $addressFamily)) { if (empty($snmpver)) { // Try SNMPv2c $snmpver = 'v2c'; @@ -501,7 +502,7 @@ function isSNMPable($device) { } } -function isPingable($hostname,$device_id = FALSE) { +function isPingable($hostname,$address_family = AF_INET,$device_id = FALSE) { global $config; $fping_params = ''; @@ -518,7 +519,7 @@ function isPingable($hostname,$device_id = FALSE) { $fping_params .= ' -p ' . $config['fping_options']['millisec']; } $response = array(); - $status = fping($hostname,$fping_params); + $status = fping($hostname,$fping_params,$address_family); if ($status['loss'] == 100) { $response['result'] = FALSE; } @@ -1186,7 +1187,7 @@ function ip_exists($ip) { return true; } -function fping($host,$params) { +function fping($host,$params,$address_family = AF_INET) { global $config; @@ -1196,7 +1197,13 @@ function fping($host,$params) { 2 => array("pipe", "w") ); - $process = proc_open($config['fping'] . ' -e -q ' .$params . ' ' .$host.' 2>&1', $descriptorspec, $pipes); + // Default to AF_INET (IPv4) + $fping_path = $config['fping']; + if ($address_family == AF_INET6) { + $fping_path = $config['fping6']; + } + + $process = proc_open($fping_path . ' -e -q ' .$params . ' ' .$host.' 2>&1', $descriptorspec, $pipes); $read = ''; if (is_resource($process)) { @@ -1230,4 +1237,17 @@ function function_check($function) { function get_last_commit() { return `git log -n 1|head -n1`; -}//end get_last_commit +}//end get_last_commit + +function snmpTransportToAddressFamily($transport) { + if (!isset($transport)) { + $transport = 'udp'; + } + + if ($transport == 'udp6' || $transport == 'tcp6') { + return AF_INET6; + } + else { + return AF_INET; + } +} diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index d97555d46..bbec52732 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -154,7 +154,9 @@ function poll_device($device, $options) { echo "Created directory : $host_rrd\n"; } - $ping_response = isPingable($device['hostname'], $device['device_id']); + $address_family = snmpTransportToAddressFamily($device['transport']); + + $ping_response = isPingable($device['hostname'], $address_family, $device['device_id']); $device_perf = $ping_response['db']; $device_perf['device_id'] = $device['device_id']; From 772d1762a7feff9849b9c1bf17f847f131be98f2 Mon Sep 17 00:00:00 2001 From: Nils Steinger Date: Tue, 22 Sep 2015 14:57:23 +0200 Subject: [PATCH 04/40] Use relative path for fping6 fping6 will be in /usr/bin on Debian-based systems, but /usr/sbin on CentOS. Have PHP figure out where fping6 is, to avoid breaking existing setups on CentOS. --- doc/Support/Configuration.md | 2 +- includes/defaults.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index 1694a4fb9..865b00b9b 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -46,7 +46,7 @@ $config['rrdtool'] = "/usr/bin/rrdtool"; ```php $config['fping'] = "/usr/bin/fping"; -$config['fping6'] = "/usr/bin/fping6"; +$config['fping6'] = "fping6"; $config['fping_options']['retries'] = 3; $config['fping_options']['timeout'] = 500; $config['fping_options']['count'] = 3; diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 9236ef353..2b28dbba6 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -52,7 +52,7 @@ $config['own_hostname'] = 'localhost'; // Location of executables $config['rrdtool'] = '/usr/bin/rrdtool'; $config['fping'] = '/usr/bin/fping'; -$config['fping6'] = '/usr/bin/fping6'; +$config['fping6'] = 'fping6'; $config['fping_options']['retries'] = 3; $config['fping_options']['timeout'] = 500; $config['fping_options']['count'] = 3; From 4c2d66791d6c729e48baf56325394cc78073ff79 Mon Sep 17 00:00:00 2001 From: Nils Steinger Date: Tue, 22 Sep 2015 15:27:36 +0200 Subject: [PATCH 05/40] Fixed typo in variable name --- includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/functions.php b/includes/functions.php index a98b5bfd3..8c3acfe93 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -276,7 +276,7 @@ function addHost($host, $snmpver, $port = '161', $transport = 'udp', $quiet = '0 if (ip_exists($ip) === false) { // Test reachability $address_family = snmpTransportToAddressFamily($transport); - if ($force_add == 1 || isPingable($host, $addressFamily)) { + if ($force_add == 1 || isPingable($host, $address_family)) { if (empty($snmpver)) { // Try SNMPv2c $snmpver = 'v2c'; From 7d7e7098ab952709e5ec4c98edad7db5b8198dff Mon Sep 17 00:00:00 2001 From: Nils Steinger Date: Thu, 24 Sep 2015 02:07:15 +0200 Subject: [PATCH 06/40] Added PHPDoc for function isPingable() --- includes/functions.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/includes/functions.php b/includes/functions.php index 8c3acfe93..b9306d895 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -502,6 +502,15 @@ function isSNMPable($device) { } } +/** + * Check if the given host responds to ICMP echo requests ("pings"). + * + * @param string $hostname The hostname or IP address to send ping requests to. + * @param int $address_family The address family (AF_INET for IPv4 or AF_INET6 for IPv6) to use. Defaults to IPv4. Will *not* be autodetected for IP addresses, so it has to be set to AF_INET6 when pinging an IPv6 address or an IPv6-only host. + * @param int $device_id This parameter is currently ignored. + * + * @return bool TRUE if the host responded to at least one ping request, FALSE otherwise. + */ function isPingable($hostname,$address_family = AF_INET,$device_id = FALSE) { global $config; From e5327594a5e27e47f6aa90a703552113c7a31969 Mon Sep 17 00:00:00 2001 From: Nils Steinger Date: Thu, 24 Sep 2015 02:07:33 +0200 Subject: [PATCH 07/40] Code formatting --- includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/functions.php b/includes/functions.php index b9306d895..cf23d07b8 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -511,7 +511,7 @@ function isSNMPable($device) { * * @return bool TRUE if the host responded to at least one ping request, FALSE otherwise. */ -function isPingable($hostname,$address_family = AF_INET,$device_id = FALSE) { +function isPingable($hostname, $address_family = AF_INET, $device_id = FALSE) { global $config; $fping_params = ''; From a973e538c4d3744004c302ad894182e5d72da8a2 Mon Sep 17 00:00:00 2001 From: Nils Steinger Date: Fri, 25 Sep 2015 19:03:47 +0200 Subject: [PATCH 08/40] Added complete list of IPv6-based SNMP transport specifiers in snmpTransportToAddressFamily() --- includes/functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/functions.php b/includes/functions.php index cf23d07b8..30aa01e0e 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1253,7 +1253,9 @@ function snmpTransportToAddressFamily($transport) { $transport = 'udp'; } - if ($transport == 'udp6' || $transport == 'tcp6') { + $ipv6_snmp_transport_specifiers = array('udp6', 'udpv6', 'udpipv6', 'tcp6', 'tcpv6', 'tcpipv6'); + + if (in_array($transport, $ipv6_snmp_transport_specifiers)) { return AF_INET6; } else { From 65ca58a1ccc57ddc746f727bd2b156bdc19c863d Mon Sep 17 00:00:00 2001 From: Nils Steinger Date: Fri, 25 Sep 2015 19:03:58 +0200 Subject: [PATCH 09/40] PHPDoc for snmpTransportToAddressFamily() --- includes/functions.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/functions.php b/includes/functions.php index 30aa01e0e..9cd2575f2 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1248,6 +1248,18 @@ function get_last_commit() { return `git log -n 1|head -n1`; }//end get_last_commit +/** + * Try to determine the address family (IPv4 or IPv6) associated with an SNMP + * transport specifier (like "udp", "udp6", etc.). + * + * @param string $transport The SNMP transport specifier, for example "udp", + * "udp6", "tcp", or "tcp6". See `man snmpcmd`, + * section "Agent Specification" for a full list. + * + * @return int The address family associated with the given transport + * specifier: AF_INET for IPv4 (or local connections not associated + * with an IP stack), AF_INET6 for IPv6. + */ function snmpTransportToAddressFamily($transport) { if (!isset($transport)) { $transport = 'udp'; From 407afd022a7797ae7f547dafae3c12e329c4e9be Mon Sep 17 00:00:00 2001 From: f0o Date: Sat, 26 Sep 2015 17:30:19 +0000 Subject: [PATCH 10/40] Add RegEx support to alert rules and device groups --- includes/alerts.inc.php | 2 +- includes/device-groups.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/alerts.inc.php b/includes/alerts.inc.php index f57c102b3..85b897ee6 100644 --- a/includes/alerts.inc.php +++ b/includes/alerts.inc.php @@ -91,7 +91,7 @@ function GenSQL($rule) { } $i++; } - $sql = "SELECT * FROM ".implode(",",$tables)." WHERE (".$join."".str_replace("(","",$tables[0]).".device_id = ?) && (".str_replace(array("%","@","!~","~"),array("","%","NOT LIKE","LIKE"),$rule).")"; + $sql = "SELECT * FROM ".implode(",",$tables)." WHERE (".$join."".str_replace("(","",$tables[0]).".device_id = ?) && (".str_replace(array("%","@","!~","~"),array("",".*","NOT REGEXP","REGEXP"),$rule).")"; return $sql; } diff --git a/includes/device-groups.inc.php b/includes/device-groups.inc.php index 3e5cee870..a1573ec03 100644 --- a/includes/device-groups.inc.php +++ b/includes/device-groups.inc.php @@ -63,7 +63,7 @@ function GenGroupSQL($pattern, $search='') { $search .= ' &&'; } - $sql = 'SELECT DISTINCT('.str_replace('(', '', $tables[0]).'.device_id) FROM '.implode(',', $tables).' WHERE '.$search.' ('.str_replace(array('%', '@', '!~', '~'), array('', '%', 'NOT LIKE', 'LIKE'), $pattern).')'; + $sql = 'SELECT DISTINCT('.str_replace('(', '', $tables[0]).'.device_id) FROM '.implode(',', $tables).' WHERE '.$search.' ('.str_replace(array('%', '@', '!~', '~'), array('', '.*', 'NOT REGEXP', 'REGEXP'), $pattern).')'; return $sql; }//end GenGroupSQL() From fe9a686e8319c56bb42ef72fdd0f01eeee5e0f92 Mon Sep 17 00:00:00 2001 From: f0o Date: Sat, 26 Sep 2015 18:25:22 +0000 Subject: [PATCH 11/40] Updated docs --- doc/Extensions/Alerting.md | 2 +- doc/Extensions/Device-Groups.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/Extensions/Alerting.md b/doc/Extensions/Alerting.md index 92d264e20..bd0b1a786 100644 --- a/doc/Extensions/Alerting.md +++ b/doc/Extensions/Alerting.md @@ -66,7 +66,7 @@ __Conditions__ can be any of: __Values__ can be Entities or any single-quoted data. __Glues__ can be either `&&` for `AND` or `||` for `OR`. -__Note__: The difference between `Equals` and `Matches` (and it's negation) is that `Equals` does a strict comparison and `Matches` allows the usage of the placeholder `@`. The placeholder `@` is comparable with `.*` in RegExp. +__Note__: The difference between `Equals` and `Matches` (and it's negation) is that `Equals` does a strict comparison and `Matches` allows the usage of RegExp. Arithmetics are allowed as well. ## Examples diff --git a/doc/Extensions/Device-Groups.md b/doc/Extensions/Device-Groups.md index cc48cdaad..c38db06a8 100644 --- a/doc/Extensions/Device-Groups.md +++ b/doc/Extensions/Device-Groups.md @@ -8,12 +8,12 @@ Patterns work in the same was as Entities within the alerting system, the format as __tablename.columnname__. If you are ensure of what the entity is you want then have a browse around inside MySQL using `show tables` and `desc `. As a working example and a common question, let's assume you want to group devices by hostname. If you hostname format is dcX.[devicetype].example.com. You would use the pattern -devices.hostname. Select the condition which in this case would Like and then enter dc1.@.example.com. This would then match dc1.sw01.example.com, dc1.rtr01.example.com but not +devices.hostname. Select the condition which in this case would Like and then enter `dc1\..*\.example.com`. This would then match dc1.sw01.example.com, dc1.rtr01.example.com but not dc2.sw01.example.com. #### Wildcards -As used in the example above, wildcards are represented by the @ symbol. I.e @.example.com would match any hostnames under example.com. +As with alerts, the `Like` operation allows RegExp. A list of common entities is maintained in our [Alerting docs](http://docs.librenms.org/Extensions/Alerting/#entities). From 047a2e0d5da53dc33be81ba1fed57a5658550ded Mon Sep 17 00:00:00 2001 From: Juho Vanhanen Date: Sat, 26 Sep 2015 21:50:29 +0300 Subject: [PATCH 12/40] Found the missing = --- html/pages/logon.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/pages/logon.inc.php b/html/pages/logon.inc.php index b2d4f33de..bd0b86cf5 100644 --- a/html/pages/logon.inc.php +++ b/html/pages/logon.inc.php @@ -29,7 +29,7 @@ else {
-
"; $i++; -}//end foreach \ No newline at end of file +}//end foreach diff --git a/html/pages/device/overview/generic/sensor.inc.php b/html/pages/device/overview/generic/sensor.inc.php index 39a841466..8b50d1de3 100644 --- a/html/pages/device/overview/generic/sensor.inc.php +++ b/html/pages/device/overview/generic/sensor.inc.php @@ -12,10 +12,6 @@ if (count($sensors)) { echo ' '; foreach ($sensors as $sensor) { - if ($config['memcached']['enable'] === true) { - $sensor['sensor_current'] = $memcache->get('sensor-'.$sensor['sensor_id'].'-value'); - } - if (empty($sensor['sensor_current'])) { $sensor['sensor_current'] = 'NaN'; } diff --git a/html/pages/device/overview/mempools.inc.php b/html/pages/device/overview/mempools.inc.php index 01895ee7d..639b33dd2 100644 --- a/html/pages/device/overview/mempools.inc.php +++ b/html/pages/device/overview/mempools.inc.php @@ -19,17 +19,6 @@ if (count($mempools)) { '; foreach ($mempools as $mempool) { - if ($config['memcached']['enable'] === true) { - $state = $memcache->get('mempool-'.$mempool['mempool_id'].'-state'); - d_echo($state); - - if (is_array($state)) { - $mempool = array_merge($mempool, $state); - } - - unset($state); - } - $percent = round($mempool['mempool_perc'], 0); $text_descr = rewrite_entity_descr($mempool['mempool_descr']); $total = formatStorage($mempool['mempool_total']); diff --git a/html/pages/device/port.inc.php b/html/pages/device/port.inc.php index bd9c38acd..bdaacd127 100644 --- a/html/pages/device/port.inc.php +++ b/html/pages/device/port.inc.php @@ -6,17 +6,6 @@ if (!isset($vars['view'])) { $port = dbFetchRow('SELECT * FROM `ports` WHERE `port_id` = ?', array($vars['port'])); -if ($config['memcached']['enable'] === true) { - $state = $memcache->get('port-'.$port['port_id'].'-state'); - d_echo($state); - - if (is_array($state)) { - $port = array_merge($port, $state); - } - - unset($state); -} - $port_details = 1; $hostname = $device['hostname']; diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php index d4cac0dbf..56d3ee542 100644 --- a/html/pages/device/ports.inc.php +++ b/html/pages/device/ports.inc.php @@ -136,19 +136,7 @@ else { } foreach ($ports as $port) { - if ($config['memcached']['enable'] === true) { - $state = $memcache->get('port-'.$port['port_id'].'-state'); - d_echo($state); - - if (is_array($state)) { - $port = array_merge($port, $state); - } - - unset($state); - } - include 'includes/print-interface.inc.php'; - $i++; } diff --git a/html/pages/health/sensors.inc.php b/html/pages/health/sensors.inc.php index 7ed65f926..b882ab4d9 100644 --- a/html/pages/health/sensors.inc.php +++ b/html/pages/health/sensors.inc.php @@ -22,11 +22,6 @@ echo ''; foreach (dbFetchRows($sql, $param) as $sensor) { - if ($config['memcached']['enable'] === true) { - $sensor['sensor_current'] = $memcache->get('sensor-'.$sensor['sensor_id'].'-value'); - d_echo('Memcached['.'sensor-'.$sensor['sensor_id'].'-value'.'='.$sensor['sensor_current'].']'); - } - if (empty($sensor['sensor_current'])) { $sensor['sensor_current'] = 'NaN'; } diff --git a/includes/dbFacile.mysql.php b/includes/dbFacile.mysql.php index 0d1d7150c..e5f3a5738 100644 --- a/includes/dbFacile.mysql.php +++ b/includes/dbFacile.mysql.php @@ -24,7 +24,7 @@ function dbQuery($sql, $parameters=array()) { - global $fullSql, $debug, $sql_debug, $console_color; + global $fullSql, $debug, $sql_debug; $fullSql = dbMakeQuery($sql, $parameters); if ($debug) { if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) { @@ -239,7 +239,14 @@ function dbDelete($table, $where=null, $parameters=array()) { function dbFetchRows($sql, $parameters=array()) { - global $db_stats; + global $db_stats, $config; + + if ($config['memcached']['enable']) { + $result = $config['memcached']['resource']->get(hash('sha512',$sql.'|'.serialize($parameters))); + if (!empty($result)) { + return $result; + } + } $time_start = microtime(true); $result = dbQuery($sql, $parameters); @@ -251,6 +258,9 @@ function dbFetchRows($sql, $parameters=array()) { } mysql_free_result($result); + if ($config['memcached']['enable']) { + $config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$rows,$config['memcached']['ttl']); + } return $rows; } @@ -296,7 +306,14 @@ function dbFetch($sql, $parameters=array()) { function dbFetchRow($sql=null, $parameters=array()) { - global $db_stats; + global $db_stats, $config; + + if ($config['memcached']['enable']) { + $result = $config['memcached']['resource']->get(hash('sha512',$sql.'|'.serialize($parameters))); + if (!empty($result)) { + return $result; + } + } $time_start = microtime(true); $result = dbQuery($sql, $parameters); @@ -308,6 +325,9 @@ function dbFetchRow($sql=null, $parameters=array()) { $db_stats['fetchrow_sec'] += number_format(($time_end - $time_start), 8); $db_stats['fetchrow']++; + if ($config['memcached']['enable']) { + $config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$row,$config['memcached']['ttl']); + } return $row; } else { diff --git a/includes/dbFacile.mysqli.php b/includes/dbFacile.mysqli.php index 2408ca990..e81ad047b 100644 --- a/includes/dbFacile.mysqli.php +++ b/includes/dbFacile.mysqli.php @@ -22,7 +22,6 @@ * Used by the other _query functions. * */ - function dbQuery($sql, $parameters=array()) { global $fullSql, $debug, $sql_debug, $console_color, $database_link; $fullSql = dbMakeQuery($sql, $parameters); @@ -240,7 +239,14 @@ function dbDelete($table, $where=null, $parameters=array()) { function dbFetchRows($sql, $parameters=array()) { - global $db_stats; + global $db_stats, $config; + + if ($config['memcached']['enable']) { + $result = $config['memcached']['resource']->get(hash('sha512',$sql.'|'.serialize($parameters))); + if (!empty($result)) { + return $result; + } + } $time_start = microtime(true); $result = dbQuery($sql, $parameters); @@ -252,6 +258,9 @@ function dbFetchRows($sql, $parameters=array()) { } mysqli_free_result($result); + if ($config['memcached']['enable']) { + $config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$rows,$config['memcached']['ttl']); + } return $rows; } @@ -297,7 +306,14 @@ function dbFetch($sql, $parameters=array()) { function dbFetchRow($sql=null, $parameters=array()) { - global $db_stats; + global $db_stats, $config; + + if ($config['memcached']['enable']) { + $result = $config['memcached']['resource']->get(hash('sha512',$sql.'|'.serialize($parameters))); + if (!empty($result)) { + return $result; + } + } $time_start = microtime(true); $result = dbQuery($sql, $parameters); @@ -309,6 +325,9 @@ function dbFetchRow($sql=null, $parameters=array()) { $db_stats['fetchrow_sec'] += number_format(($time_end - $time_start), 8); $db_stats['fetchrow']++; + if ($config['memcached']['enable']) { + $config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$rows,$config['memcached']['ttl']); + } return $row; } else { @@ -326,7 +345,8 @@ function dbFetchRow($sql=null, $parameters=array()) { function dbFetchCell($sql, $parameters=array()) { - global $db_stats; + global $db_stats, $config; + $time_start = microtime(true); $row = dbFetchRow($sql, $parameters); if ($row) { diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index c1a86e0c1..e42195015 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -75,6 +75,7 @@ $config['sfdp'] = '/usr/bin/sfdp'; $config['memcached']['enable'] = false; $config['memcached']['host'] = 'localhost'; $config['memcached']['port'] = 11211; +$config['memcached']['ttl'] = 240; $config['slow_statistics'] = true; // THIS WILL CHANGE TO FALSE IN FUTURE diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index 40162649c..23f6dd97b 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -30,6 +30,22 @@ else { $database_db = mysql_select_db($config['db_name'], $database_link); } +$config['time']['now'] = time(); +$config['time']['now'] -= ($config['time']['now'] % 300); + +if ($config['memcached']['enable'] === true) { + if (class_exists('Memcached')) { + $config['memcached']['ttl'] += $config['time']['now']; + $config['memcached']['resource'] = new Memcached(); + $config['memcached']['resource']->addServer($config['memcached']['host'], $config['memcached']['port']); + } + else { + echo "WARNING: You have enabled memcached but have not installed the PHP bindings. Disabling memcached support.\n"; + echo "Try 'apt-get install php5-memcached' or 'pecl install memcached'. You will need the php5-dev and libmemcached-dev packages to use pecl.\n\n"; + $config['memcached']['enable'] = 0; + } +} + $clone = $config; foreach (dbFetchRows('select config_name,config_value from config') as $obj) { $clone = array_replace_recursive($clone, mergecnf($obj)); @@ -1703,22 +1719,7 @@ if (isset($_SERVER['HTTPS'])) { $config['base_url'] = preg_replace('/^http:/', 'https:', $config['base_url']); } -if ($config['memcached']['enable'] === true) { - if (class_exists('Memcached')) { - $memcache = new Memcached(); - $memcache->addServer($config['memcached']['host'], $config['memcached']['port']); - $memcache->getStats(); - } - else { - echo "WARNING: You have enabled memcached but have not installed the PHP bindings. Disabling memcached support.\n"; - echo "Try 'apt-get install php5-memcached' or 'pecl install memcached'. You will need the php5-dev and libmemcached-dev packages to use pecl.\n\n"; - $config['memcached']['enable'] = 0; - } -} - // Set some times needed by loads of scripts (it's dynamic, so we do it here!) -$config['time']['now'] = time(); -$config['time']['now'] -= ($config['time']['now'] % 300); $config['time']['fourhour'] = ($config['time']['now'] - 14400); // time() - (4 * 60 * 60); $config['time']['sixhour'] = ($config['time']['now'] - 21600); diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index ffe79340e..86acb711c 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -119,12 +119,7 @@ function poll_sensor($device, $class, $unit) { log_event(ucfirst($class).' '.$sensor['sensor_descr'].' above threshold: '.$sensor_value." $unit (> ".$sensor['sensor_limit']." $unit)", $device, $class, $sensor['sensor_id']); } - if ($config['memcached']['enable'] === true) { - $memcache->set('sensor-'.$sensor['sensor_id'].'-value', $sensor_value); - } - else { - dbUpdate(array('sensor_current' => $sensor_value), 'sensors', '`sensor_class` = ? AND `sensor_id` = ?', array($class, $sensor['sensor_id'])); - } + dbUpdate(array('sensor_current' => $sensor_value), 'sensors', '`sensor_class` = ? AND `sensor_id` = ?', array($class, $sensor['sensor_id'])); }//end foreach }//end poll_sensor() diff --git a/includes/polling/mempools.inc.php b/includes/polling/mempools.inc.php index 01188b8a6..a36196c1d 100644 --- a/includes/polling/mempools.inc.php +++ b/includes/polling/mempools.inc.php @@ -47,14 +47,7 @@ foreach (dbFetchRows('SELECT * FROM mempools WHERE device_id = ?', array($device $mempool['state']['mempool_lowestfree'] = $mempool['lowestfree']; } - if ($config['memcached']['enable'] === true) { - d_echo($mempool['state']); - - $memcache->set('mempool-'.$mempool['mempool_id'].'-value', $mempool['state']); - } - else { - dbUpdate($mempool['state'], 'mempools', '`mempool_id` = ?', array($mempool['mempool_id'])); - } + dbUpdate($mempool['state'], 'mempools', '`mempool_id` = ?', array($mempool['mempool_id'])); echo "\n"; }//end foreach diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index b0d61a564..bd4af141a 100644 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -244,17 +244,6 @@ foreach ($ports as $port) { $this_port['ifDescr'] = $matches[1]; } - if ($config['memcached']['enable'] === true) { - $state = $memcache->get('port-'.$port['port_id'].'-state'); - d_echo($state); - - if (is_array($state)) { - $port = array_merge($port, $state); - } - - unset($state); - } - $polled_period = ($polled - $port['poll_time']); $port['update'] = array(); @@ -266,12 +255,6 @@ foreach ($ports as $port) { $port['update']['poll_period'] = $polled_period; } - if ($config['memcached']['enable'] === true) { - $port['state']['poll_time'] = $polled; - $port['state']['poll_prev'] = $port['poll_time']; - $port['state']['poll_period'] = $polled_period; - } - // Copy ifHC[In|Out]Octets values to non-HC if they exist if ($this_port['ifHCInOctets'] > 0 && is_numeric($this_port['ifHCInOctets']) && $this_port['ifHCOutOctets'] > 0 && is_numeric($this_port['ifHCOutOctets'])) { echo 'HC '; @@ -400,11 +383,6 @@ foreach ($ports as $port) { $port['update'][$oid.'_prev'] = $port[$oid]; } - if ($config['memcached']['enable'] === true) { - $port['state'][$oid] = $this_port[$oid]; - $port['state'][$oid.'_prev'] = $port[$oid]; - } - $oid_prev = $oid.'_prev'; if (isset($port[$oid])) { $oid_diff = ($this_port[$oid] - $port[$oid]); @@ -422,11 +400,6 @@ foreach ($ports as $port) { $port['update'][$oid.'_delta'] = $oid_diff; } - if ($config['memcached']['enable'] === true) { - $port['state'][$oid.'_rate'] = $oid_rate; - $port['state'][$oid.'_delta'] = $oid_diff; - } - d_echo("\n $oid ($oid_diff B) $oid_rate Bps $polled_period secs\n"); }//end if }//end foreach @@ -451,13 +424,6 @@ foreach ($ports as $port) { echo 'bytes('.formatStorage($port['stats']['ifInOctets_diff']).'/'.formatStorage($port['stats']['ifOutOctets_diff']).')'; echo 'pkts('.format_si($port['stats']['ifInUcastPkts_rate']).'pps/'.format_si($port['stats']['ifOutUcastPkts_rate']).'pps)'; - // Store aggregate in/out state - if ($config['memcached']['enable'] === true) { - $port['state']['ifOctets_rate'] = ($port['stats']['ifOutOctets_rate'] + $port['stats']['ifInOctets_rate']); - $port['state']['ifUcastPkts_rate'] = ($port['stats']['ifOutUcastPkts_rate'] + $port['stats']['ifInUcastPkts_rate']); - $port['state']['ifErrors_rate'] = ($port['stats']['ifOutErrors_rate'] + $port['stats']['ifInErrors_rate']); - } - // Port utilisation % threshold alerting. // FIXME allow setting threshold per-port. probably 90% of ports we don't care about. if ($config['alerts']['port_util_alert'] && $port['ignore'] == '0') { // Check for port saturation of $config['alerts']['port_util_perc'] or higher. Alert if we see this. @@ -547,13 +513,6 @@ foreach ($ports as $port) { include 'port-alcatel.inc.php'; } - // Update Memcached - if ($config['memcached']['enable'] === true) { - d_echo($port['state']); - - $memcache->set('port-'.$port['port_id'].'-state', $port['state']); - } - foreach ($port['update'] as $key => $val_check) { if (!isset($val_check)) { unset($port['update'][$key]); diff --git a/includes/polling/storage.inc.php b/includes/polling/storage.inc.php index 6b2e662f6..23cff2e47 100644 --- a/includes/polling/storage.inc.php +++ b/includes/polling/storage.inc.php @@ -37,16 +37,7 @@ foreach (dbFetchRows('SELECT * FROM storage WHERE device_id = ?', array($device[ rrdtool_update($storage_rrd, $fields); - if ($config['memcached']['enable'] === true) { - $memcache->set('storage-'.$storage['storage_id'].'-used', $storage['used']); - $memcache->set('storage-'.$storage['storage_id'].'-free', $storage['free']); - $memcache->set('storage-'.$storage['storage_id'].'-size', $storage['size']); - $memcache->set('storage-'.$storage['storage_id'].'-units', $storage['units']); - $memcache->set('storage-'.$storage['storage_id'].'-perc', $percent); - } - else { - $update = dbUpdate(array('storage_used' => $storage['used'], 'storage_free' => $storage['free'], 'storage_size' => $storage['size'], 'storage_units' => $storage['units'], 'storage_perc' => $percent), 'storage', '`storage_id` = ?', array($storage['storage_id'])); - } + $update = dbUpdate(array('storage_used' => $storage['used'], 'storage_free' => $storage['free'], 'storage_size' => $storage['size'], 'storage_units' => $storage['units'], 'storage_perc' => $percent), 'storage', '`storage_id` = ?', array($storage['storage_id'])); echo "\n"; }//end foreach From 41d996ef9896812604e8e554b2f54c674aa13ced Mon Sep 17 00:00:00 2001 From: Daniel Preussker Date: Sun, 27 Sep 2015 19:44:59 +0000 Subject: [PATCH 16/40] scrut fixes --- includes/dbFacile.mysql.php | 2 +- includes/dbFacile.mysqli.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/dbFacile.mysql.php b/includes/dbFacile.mysql.php index e5f3a5738..e51a695b7 100644 --- a/includes/dbFacile.mysql.php +++ b/includes/dbFacile.mysql.php @@ -24,7 +24,7 @@ function dbQuery($sql, $parameters=array()) { - global $fullSql, $debug, $sql_debug; + global $fullSql, $debug, $sql_debug, $console_color; $fullSql = dbMakeQuery($sql, $parameters); if ($debug) { if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) { diff --git a/includes/dbFacile.mysqli.php b/includes/dbFacile.mysqli.php index e81ad047b..e956e78ba 100644 --- a/includes/dbFacile.mysqli.php +++ b/includes/dbFacile.mysqli.php @@ -22,6 +22,7 @@ * Used by the other _query functions. * */ + function dbQuery($sql, $parameters=array()) { global $fullSql, $debug, $sql_debug, $console_color, $database_link; $fullSql = dbMakeQuery($sql, $parameters); From a321ba1bf60e3029603201a559a92c93be22b42f Mon Sep 17 00:00:00 2001 From: Daniel Preussker Date: Sun, 27 Sep 2015 19:56:20 +0000 Subject: [PATCH 17/40] Added docs --- doc/Extensions/Memcached.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 doc/Extensions/Memcached.md diff --git a/doc/Extensions/Memcached.md b/doc/Extensions/Memcached.md new file mode 100644 index 000000000..ae55ff342 --- /dev/null +++ b/doc/Extensions/Memcached.md @@ -0,0 +1,16 @@ +# Memcached + +LibreNMS can store SQL results in memcached to achieve performance advantages of in-memory value storage and removing work load for frequent queries off the MySQL backend. + +To enable memcached in your install you need to have `memcached` installed and the PHP extension `php5-memcached` or `php-memcached` and add the following lines to your `config.php`: + +```php +$config['memcached']['enable'] = true; +$config['memcached']['host'] = "localhost"; +$config['memcached']['port'] = 11211; +``` + +By default values are kept for 4 Minutes inside the memcached, you can adjust this retention time by modifying the `$config['memcached']['ttl']` value to any desired amount of seconds. +It's strongly discouraged to set this above `300` (5 Minutes) to avoid interferences with the polling, discovery and alerting processes. + +If you use the Distributed Poller, you can point this to the same memcached instance. However a local memcached will perform better in any case. From 7d95e949548aa644c13ed445b0b17464f906a395 Mon Sep 17 00:00:00 2001 From: f0o Date: Mon, 28 Sep 2015 08:24:57 +0000 Subject: [PATCH 18/40] Fix rrd creation parameters --- includes/polling/applications/apache.inc.php | 40 ++--- includes/polling/applications/bind.inc.php | 20 +-- includes/polling/applications/drbd.inc.php | 22 +-- .../polling/applications/mailscanner.inc.php | 14 +- .../polling/applications/memcached.inc.php | 38 ++--- includes/polling/applications/mysql.inc.php | 158 +++++++++--------- includes/polling/applications/nginx.inc.php | 10 +- .../polling/applications/ntp-client.inc.php | 10 +- .../polling/applications/ntpd-server.inc.php | 28 ++-- .../polling/applications/powerdns.inc.php | 44 ++--- includes/polling/applications/proxmox.inc.php | 4 +- .../polling/applications/shoutcast.inc.php | 16 +- includes/polling/applications/tinydns.inc.php | 40 ++--- includes/polling/bgp-peers.inc.php | 16 +- includes/polling/cisco-cef.inc.php | 6 +- includes/polling/cisco-mac-accounting.inc.php | 6 +- includes/polling/cisco-sla.inc.php | 2 +- includes/polling/entity-physical.inc.php | 10 +- includes/polling/functions.inc.php | 2 +- includes/polling/hr-mib.inc.php | 4 +- includes/polling/ipmi.inc.php | 2 +- includes/polling/junose-atm-vp.inc.php | 18 +- includes/polling/os/procurve.inc.php | 2 +- includes/polling/os/screenos.inc.php | 6 +- includes/polling/os/snom.inc.php | 10 +- includes/polling/ospf.inc.php | 8 +- includes/polling/ports.inc.php | 30 ++-- includes/polling/processors.inc.php | 2 +- includes/polling/toner.inc.php | 2 +- includes/polling/ucd-diskio.inc.php | 8 +- includes/polling/ucd-mib.inc.php | 24 +-- includes/polling/wifi.inc.php | 4 +- includes/rrdtool.inc.php | 2 +- 33 files changed, 304 insertions(+), 304 deletions(-) diff --git a/includes/polling/applications/apache.inc.php b/includes/polling/applications/apache.inc.php index e9cbe782d..3c75d38cd 100644 --- a/includes/polling/applications/apache.inc.php +++ b/includes/polling/applications/apache.inc.php @@ -22,26 +22,26 @@ list ($total_access, $total_kbyte, $cpuload, $uptime, $reqpersec, $bytespersec, if (!is_file($rrd_filename)) { rrdtool_create( $rrd_filename, - '--step 300 \ - DS:access:DERIVE:600:0:125000000000 \ - DS:kbyte:DERIVE:600:0:125000000000 \ - DS:cpu:GAUGE:600:0:125000000000 \ - DS:uptime:GAUGE:600:0:125000000000 \ - DS:reqpersec:GAUGE:600:0:125000000000 \ - DS:bytespersec:GAUGE:600:0:125000000000 \ - DS:byesperreq:GAUGE:600:0:125000000000 \ - DS:busyworkers:GAUGE:600:0:125000000000 \ - DS:idleworkers:GAUGE:600:0:125000000000 \ - DS:sb_wait:GAUGE:600:0:125000000000 \ - DS:sb_start:GAUGE:600:0:125000000000 \ - DS:sb_reading:GAUGE:600:0:125000000000 \ - DS:sb_writing:GAUGE:600:0:125000000000 \ - DS:sb_keepalive:GAUGE:600:0:125000000000 \ - DS:sb_dns:GAUGE:600:0:125000000000 \ - DS:sb_closing:GAUGE:600:0:125000000000 \ - DS:sb_logging:GAUGE:600:0:125000000000 \ - DS:sb_graceful:GAUGE:600:0:125000000000 \ - DS:sb_idle:GAUGE:600:0:125000000000 \ + '--step 300 + DS:access:DERIVE:600:0:125000000000 + DS:kbyte:DERIVE:600:0:125000000000 + DS:cpu:GAUGE:600:0:125000000000 + DS:uptime:GAUGE:600:0:125000000000 + DS:reqpersec:GAUGE:600:0:125000000000 + DS:bytespersec:GAUGE:600:0:125000000000 + DS:byesperreq:GAUGE:600:0:125000000000 + DS:busyworkers:GAUGE:600:0:125000000000 + DS:idleworkers:GAUGE:600:0:125000000000 + DS:sb_wait:GAUGE:600:0:125000000000 + DS:sb_start:GAUGE:600:0:125000000000 + DS:sb_reading:GAUGE:600:0:125000000000 + DS:sb_writing:GAUGE:600:0:125000000000 + DS:sb_keepalive:GAUGE:600:0:125000000000 + DS:sb_dns:GAUGE:600:0:125000000000 + DS:sb_closing:GAUGE:600:0:125000000000 + DS:sb_logging:GAUGE:600:0:125000000000 + DS:sb_graceful:GAUGE:600:0:125000000000 + DS:sb_idle:GAUGE:600:0:125000000000 DS:sb_open:GAUGE:600:0:125000000000 '.$config['rrd_rra'] ); }//end if diff --git a/includes/polling/applications/bind.inc.php b/includes/polling/applications/bind.inc.php index b56d1425f..8e89e7c49 100644 --- a/includes/polling/applications/bind.inc.php +++ b/includes/polling/applications/bind.inc.php @@ -72,16 +72,16 @@ if (!empty($agent_data['app']['bind']) && $app['app_id'] > 0) { if (!is_file($rrd_filename)) { rrdtool_create( $rrd_filename, - '--step 300 \ - DS:any:COUNTER:600:0:125000000000 \ - DS:a:COUNTER:600:0:125000000000 \ - DS:aaaa:COUNTER:600:0:125000000000 \ - DS:cname:COUNTER:600:0:125000000000 \ - DS:mx:COUNTER:600:0:125000000000 \ - DS:ns:COUNTER:600:0:125000000000 \ - DS:ptr:COUNTER:600:0:125000000000 \ - DS:soa:COUNTER:600:0:125000000000 \ - DS:srv:COUNTER:600:0:125000000000 \ + '--step 300 + DS:any:COUNTER:600:0:125000000000 + DS:a:COUNTER:600:0:125000000000 + DS:aaaa:COUNTER:600:0:125000000000 + DS:cname:COUNTER:600:0:125000000000 + DS:mx:COUNTER:600:0:125000000000 + DS:ns:COUNTER:600:0:125000000000 + DS:ptr:COUNTER:600:0:125000000000 + DS:soa:COUNTER:600:0:125000000000 + DS:srv:COUNTER:600:0:125000000000 DS:spf:COUNTER:600:0:125000000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/applications/drbd.inc.php b/includes/polling/applications/drbd.inc.php index 4e2eea853..8e3b8e478 100644 --- a/includes/polling/applications/drbd.inc.php +++ b/includes/polling/applications/drbd.inc.php @@ -12,17 +12,17 @@ foreach (explode('|', $agent_data['app']['drbd'][$app['app_instance']]) as $part if (!is_file($rrd_filename)) { rrdtool_create( $rrd_filename, - '--step 300 \ - DS:ns:DERIVE:600:0:125000000000 \ - DS:nr:DERIVE:600:0:125000000000 \ - DS:dw:DERIVE:600:0:125000000000 \ - DS:dr:DERIVE:600:0:125000000000 \ - DS:al:DERIVE:600:0:125000000000 \ - DS:bm:DERIVE:600:0:125000000000 \ - DS:lo:GAUGE:600:0:125000000000 \ - DS:pe:GAUGE:600:0:125000000000 \ - DS:ua:GAUGE:600:0:125000000000 \ - DS:ap:GAUGE:600:0:125000000000 \ + '--step 300 + DS:ns:DERIVE:600:0:125000000000 + DS:nr:DERIVE:600:0:125000000000 + DS:dw:DERIVE:600:0:125000000000 + DS:dr:DERIVE:600:0:125000000000 + DS:al:DERIVE:600:0:125000000000 + DS:bm:DERIVE:600:0:125000000000 + DS:lo:GAUGE:600:0:125000000000 + DS:pe:GAUGE:600:0:125000000000 + DS:ua:GAUGE:600:0:125000000000 + DS:ap:GAUGE:600:0:125000000000 DS:oos:GAUGE:600:0:125000000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/applications/mailscanner.inc.php b/includes/polling/applications/mailscanner.inc.php index 86c4dee0a..8b9a1efd2 100644 --- a/includes/polling/applications/mailscanner.inc.php +++ b/includes/polling/applications/mailscanner.inc.php @@ -14,13 +14,13 @@ list ($msg_recv, $msg_rejected, $msg_relay, $msg_sent, $msg_waiting, $spam, $vir if (!is_file($rrd_filename)) { rrdtool_create( $rrd_filename, - '--step 300 \ - DS:msg_recv:COUNTER:600:0:125000000000 \ - DS:msg_rejected:COUNTER:600:0:125000000000 \ - DS:msg_relay:COUNTER:600:0:125000000000 \ - DS:msg_sent:COUNTER:600:0:125000000000 \ - DS:msg_waiting:COUNTER:600:0:125000000000 \ - DS:spam:COUNTER:600:0:125000000000 \ + '--step 300 + DS:msg_recv:COUNTER:600:0:125000000000 + DS:msg_rejected:COUNTER:600:0:125000000000 + DS:msg_relay:COUNTER:600:0:125000000000 + DS:msg_sent:COUNTER:600:0:125000000000 + DS:msg_waiting:COUNTER:600:0:125000000000 + DS:spam:COUNTER:600:0:125000000000 DS:virus:COUNTER:600:0:125000000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/applications/memcached.inc.php b/includes/polling/applications/memcached.inc.php index fd56ffe7d..27bf68400 100644 --- a/includes/polling/applications/memcached.inc.php +++ b/includes/polling/applications/memcached.inc.php @@ -9,25 +9,25 @@ echo 'memcached('.$app['app_instance'].') '; if (!is_file($rrd_filename)) { rrdtool_create( $rrd_filename, - '--step 300 \ - DS:uptime:GAUGE:600:0:125000000000 \ - DS:threads:GAUGE:600:0:125000000000 \ - DS:rusage_user_ms:DERIVE:600:0:125000000000 \ - DS:rusage_system_ms:DERIVE:600:0:125000000000 \ - DS:curr_items:GAUGE:600:0:125000000000 \ - DS:total_items:DERIVE:600:0:125000000000 \ - DS:limit_maxbytes:GAUGE:600:0:125000000000 \ - DS:curr_connections:GAUGE:600:0:125000000000 \ - DS:total_connections:DERIVE:600:0:125000000000 \ - DS:conn_structures:GAUGE:600:0:125000000000 \ - DS:bytes:GAUGE:600:0:125000000000 \ - DS:cmd_get:DERIVE:600:0:125000000000 \ - DS:cmd_set:DERIVE:600:0:125000000000 \ - DS:get_hits:DERIVE:600:0:125000000000 \ - DS:get_misses:DERIVE:600:0:125000000000 \ - DS:evictions:DERIVE:600:0:125000000000 \ - DS:bytes_read:DERIVE:600:0:125000000000 \ - DS:bytes_written:DERIVE:600:0:125000000000 \ + '--step 300 + DS:uptime:GAUGE:600:0:125000000000 + DS:threads:GAUGE:600:0:125000000000 + DS:rusage_user_ms:DERIVE:600:0:125000000000 + DS:rusage_system_ms:DERIVE:600:0:125000000000 + DS:curr_items:GAUGE:600:0:125000000000 + DS:total_items:DERIVE:600:0:125000000000 + DS:limit_maxbytes:GAUGE:600:0:125000000000 + DS:curr_connections:GAUGE:600:0:125000000000 + DS:total_connections:DERIVE:600:0:125000000000 + DS:conn_structures:GAUGE:600:0:125000000000 + DS:bytes:GAUGE:600:0:125000000000 + DS:cmd_get:DERIVE:600:0:125000000000 + DS:cmd_set:DERIVE:600:0:125000000000 + DS:get_hits:DERIVE:600:0:125000000000 + DS:get_misses:DERIVE:600:0:125000000000 + DS:evictions:DERIVE:600:0:125000000000 + DS:bytes_read:DERIVE:600:0:125000000000 + DS:bytes_written:DERIVE:600:0:125000000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/applications/mysql.inc.php b/includes/polling/applications/mysql.inc.php index fa78ccb1d..78310711d 100644 --- a/includes/polling/applications/mysql.inc.php +++ b/includes/polling/applications/mysql.inc.php @@ -118,85 +118,85 @@ $string = implode(':', $values); if (!is_file($mysql_rrd)) { rrdtool_create( $mysql_rrd, - '--step 300 \ - DS:IDBLBSe:GAUGE:600:0:125000000000 \ - DS:IBLFh:DERIVE:600:0:125000000000 \ - DS:IBLWn:DERIVE:600:0:125000000000 \ - DS:SRows:DERIVE:600:0:125000000000 \ - DS:SRange:DERIVE:600:0:125000000000 \ - DS:SMPs:DERIVE:600:0:125000000000 \ - DS:SScan:DERIVE:600:0:125000000000 \ - DS:IBIRd:DERIVE:600:0:125000000000 \ - DS:IBIWr:DERIVE:600:0:125000000000 \ - DS:IBILg:DERIVE:600:0:125000000000 \ - DS:IBIFSc:DERIVE:600:0:125000000000 \ - DS:IDBRDd:DERIVE:600:0:125000000000 \ - DS:IDBRId:DERIVE:600:0:125000000000 \ - DS:IDBRRd:DERIVE:600:0:125000000000 \ - DS:IDBRUd:DERIVE:600:0:125000000000 \ - DS:IBRd:DERIVE:600:0:125000000000 \ - DS:IBCd:DERIVE:600:0:125000000000 \ - DS:IBWr:DERIVE:600:0:125000000000 \ - DS:TLIe:DERIVE:600:0:125000000000 \ - DS:TLWd:DERIVE:600:0:125000000000 \ - DS:IBPse:GAUGE:600:0:125000000000 \ - DS:IBPDBp:GAUGE:600:0:125000000000 \ - DS:IBPFe:GAUGE:600:0:125000000000 \ - DS:IBPMps:GAUGE:600:0:125000000000 \ - DS:TOC:GAUGE:600:0:125000000000 \ - DS:OFs:GAUGE:600:0:125000000000 \ - DS:OTs:GAUGE:600:0:125000000000 \ - DS:OdTs:COUNTER:600:0:125000000000 \ - DS:IBSRs:DERIVE:600:0:125000000000 \ - DS:IBSWs:DERIVE:600:0:125000000000 \ - DS:IBOWs:DERIVE:600:0:125000000000 \ - DS:QCs:GAUGE:600:0:125000000000 \ - DS:QCeFy:GAUGE:600:0:125000000000 \ - DS:MaCs:GAUGE:600:0:125000000000 \ - DS:MUCs:GAUGE:600:0:125000000000 \ - DS:ACs:DERIVE:600:0:125000000000 \ - DS:AdCs:DERIVE:600:0:125000000000 \ - DS:TCd:GAUGE:600:0:125000000000 \ - DS:Cs:DERIVE:600:0:125000000000 \ - DS:IBTNx:DERIVE:600:0:125000000000 \ - DS:KRRs:DERIVE:600:0:125000000000 \ - DS:KRs:DERIVE:600:0:125000000000 \ - DS:KWR:DERIVE:600:0:125000000000 \ - DS:KWs:DERIVE:600:0:125000000000 \ - DS:QCQICe:DERIVE:600:0:125000000000 \ - DS:QCHs:DERIVE:600:0:125000000000 \ - DS:QCIs:DERIVE:600:0:125000000000 \ - DS:QCNCd:DERIVE:600:0:125000000000 \ - DS:QCLMPs:DERIVE:600:0:125000000000 \ - DS:CTMPDTs:DERIVE:600:0:125000000000 \ - DS:CTMPTs:DERIVE:600:0:125000000000 \ - DS:CTMPFs:DERIVE:600:0:125000000000 \ - DS:IBIIs:DERIVE:600:0:125000000000 \ - DS:IBIMRd:DERIVE:600:0:125000000000 \ - DS:IBIMs:DERIVE:600:0:125000000000 \ - DS:IBILog:DERIVE:602:0:125000000000 \ - DS:IBISc:DERIVE:602:0:125000000000 \ - DS:IBIFLg:DERIVE:600:0:125000000000 \ - DS:IBFBl:DERIVE:600:0:125000000000 \ - DS:IBIIAo:DERIVE:600:0:125000000000 \ - DS:IBIAd:DERIVE:600:0:125000000000 \ - DS:IBIAe:DERIVE:600:0:125000000000 \ - DS:SFJn:DERIVE:600:0:125000000000 \ - DS:SFRJn:DERIVE:600:0:125000000000 \ - DS:SRe:DERIVE:600:0:125000000000 \ - DS:SRCk:DERIVE:600:0:125000000000 \ - DS:SSn:DERIVE:600:0:125000000000 \ - DS:SQs:DERIVE:600:0:125000000000 \ - DS:BRd:DERIVE:600:0:125000000000 \ - DS:BSt:DERIVE:600:0:125000000000 \ - DS:CDe:DERIVE:600:0:125000000000 \ - DS:CIt:DERIVE:600:0:125000000000 \ - DS:CISt:DERIVE:600:0:125000000000 \ - DS:CLd:DERIVE:600:0:125000000000 \ - DS:CRe:DERIVE:600:0:125000000000 \ - DS:CRSt:DERIVE:600:0:125000000000 \ - DS:CSt:DERIVE:600:0:125000000000 \ - DS:CUe:DERIVE:600:0:125000000000 \ + '--step 300 + DS:IDBLBSe:GAUGE:600:0:125000000000 + DS:IBLFh:DERIVE:600:0:125000000000 + DS:IBLWn:DERIVE:600:0:125000000000 + DS:SRows:DERIVE:600:0:125000000000 + DS:SRange:DERIVE:600:0:125000000000 + DS:SMPs:DERIVE:600:0:125000000000 + DS:SScan:DERIVE:600:0:125000000000 + DS:IBIRd:DERIVE:600:0:125000000000 + DS:IBIWr:DERIVE:600:0:125000000000 + DS:IBILg:DERIVE:600:0:125000000000 + DS:IBIFSc:DERIVE:600:0:125000000000 + DS:IDBRDd:DERIVE:600:0:125000000000 + DS:IDBRId:DERIVE:600:0:125000000000 + DS:IDBRRd:DERIVE:600:0:125000000000 + DS:IDBRUd:DERIVE:600:0:125000000000 + DS:IBRd:DERIVE:600:0:125000000000 + DS:IBCd:DERIVE:600:0:125000000000 + DS:IBWr:DERIVE:600:0:125000000000 + DS:TLIe:DERIVE:600:0:125000000000 + DS:TLWd:DERIVE:600:0:125000000000 + DS:IBPse:GAUGE:600:0:125000000000 + DS:IBPDBp:GAUGE:600:0:125000000000 + DS:IBPFe:GAUGE:600:0:125000000000 + DS:IBPMps:GAUGE:600:0:125000000000 + DS:TOC:GAUGE:600:0:125000000000 + DS:OFs:GAUGE:600:0:125000000000 + DS:OTs:GAUGE:600:0:125000000000 + DS:OdTs:COUNTER:600:0:125000000000 + DS:IBSRs:DERIVE:600:0:125000000000 + DS:IBSWs:DERIVE:600:0:125000000000 + DS:IBOWs:DERIVE:600:0:125000000000 + DS:QCs:GAUGE:600:0:125000000000 + DS:QCeFy:GAUGE:600:0:125000000000 + DS:MaCs:GAUGE:600:0:125000000000 + DS:MUCs:GAUGE:600:0:125000000000 + DS:ACs:DERIVE:600:0:125000000000 + DS:AdCs:DERIVE:600:0:125000000000 + DS:TCd:GAUGE:600:0:125000000000 + DS:Cs:DERIVE:600:0:125000000000 + DS:IBTNx:DERIVE:600:0:125000000000 + DS:KRRs:DERIVE:600:0:125000000000 + DS:KRs:DERIVE:600:0:125000000000 + DS:KWR:DERIVE:600:0:125000000000 + DS:KWs:DERIVE:600:0:125000000000 + DS:QCQICe:DERIVE:600:0:125000000000 + DS:QCHs:DERIVE:600:0:125000000000 + DS:QCIs:DERIVE:600:0:125000000000 + DS:QCNCd:DERIVE:600:0:125000000000 + DS:QCLMPs:DERIVE:600:0:125000000000 + DS:CTMPDTs:DERIVE:600:0:125000000000 + DS:CTMPTs:DERIVE:600:0:125000000000 + DS:CTMPFs:DERIVE:600:0:125000000000 + DS:IBIIs:DERIVE:600:0:125000000000 + DS:IBIMRd:DERIVE:600:0:125000000000 + DS:IBIMs:DERIVE:600:0:125000000000 + DS:IBILog:DERIVE:602:0:125000000000 + DS:IBISc:DERIVE:602:0:125000000000 + DS:IBIFLg:DERIVE:600:0:125000000000 + DS:IBFBl:DERIVE:600:0:125000000000 + DS:IBIIAo:DERIVE:600:0:125000000000 + DS:IBIAd:DERIVE:600:0:125000000000 + DS:IBIAe:DERIVE:600:0:125000000000 + DS:SFJn:DERIVE:600:0:125000000000 + DS:SFRJn:DERIVE:600:0:125000000000 + DS:SRe:DERIVE:600:0:125000000000 + DS:SRCk:DERIVE:600:0:125000000000 + DS:SSn:DERIVE:600:0:125000000000 + DS:SQs:DERIVE:600:0:125000000000 + DS:BRd:DERIVE:600:0:125000000000 + DS:BSt:DERIVE:600:0:125000000000 + DS:CDe:DERIVE:600:0:125000000000 + DS:CIt:DERIVE:600:0:125000000000 + DS:CISt:DERIVE:600:0:125000000000 + DS:CLd:DERIVE:600:0:125000000000 + DS:CRe:DERIVE:600:0:125000000000 + DS:CRSt:DERIVE:600:0:125000000000 + DS:CSt:DERIVE:600:0:125000000000 + DS:CUe:DERIVE:600:0:125000000000 DS:CUMi:DERIVE:600:0:125000000000 '.$config['rrd_rra'] ); }//end if diff --git a/includes/polling/applications/nginx.inc.php b/includes/polling/applications/nginx.inc.php index 7426641fb..81fb4a847 100644 --- a/includes/polling/applications/nginx.inc.php +++ b/includes/polling/applications/nginx.inc.php @@ -16,11 +16,11 @@ list($active, $reading, $writing, $waiting, $req) = explode("\n", $nginx); if (!is_file($nginx_rrd)) { rrdtool_create( $nginx_rrd, - '--step 300 \ - DS:Requests:DERIVE:600:0:125000000000 \ - DS:Active:GAUGE:600:0:125000000000 \ - DS:Reading:GAUGE:600:0:125000000000 \ - DS:Writing:GAUGE:600:0:125000000000 \ + '--step 300 + DS:Requests:DERIVE:600:0:125000000000 + DS:Active:GAUGE:600:0:125000000000 + DS:Reading:GAUGE:600:0:125000000000 + DS:Writing:GAUGE:600:0:125000000000 DS:Waiting:GAUGE:600:0:125000000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/applications/ntp-client.inc.php b/includes/polling/applications/ntp-client.inc.php index 921086491..00178e248 100644 --- a/includes/polling/applications/ntp-client.inc.php +++ b/includes/polling/applications/ntp-client.inc.php @@ -14,11 +14,11 @@ list ($offset, $frequency, $jitter, $noise, $stability) = explode("\n", $ntpclie if (!is_file($rrd_filename)) { rrdtool_create( $rrd_filename, - '--step 300 \ - DS:offset:GAUGE:600:-1000:1000 \ - DS:frequency:GAUGE:600:-1000:1000 \ - DS:jitter:GAUGE:600:-1000:1000 \ - DS:noise:GAUGE:600:-1000:1000 \ + '--step 300 + DS:offset:GAUGE:600:-1000:1000 + DS:frequency:GAUGE:600:-1000:1000 + DS:jitter:GAUGE:600:-1000:1000 + DS:noise:GAUGE:600:-1000:1000 DS:stability:GAUGE:600:-1000:1000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/applications/ntpd-server.inc.php b/includes/polling/applications/ntpd-server.inc.php index b338c7bca..f6267ce16 100644 --- a/includes/polling/applications/ntpd-server.inc.php +++ b/includes/polling/applications/ntpd-server.inc.php @@ -16,20 +16,20 @@ list ($stratum, $offset, $frequency, $jitter, $noise, $stability, $uptime, if (!is_file($rrd_filename)) { rrdtool_create( $rrd_filename, - '--step 300 \ - DS:stratum:GAUGE:600:-1000:1000 \ - DS:offset:GAUGE:600:-1000:1000 \ - DS:frequency:GAUGE:600:-1000:1000 \ - DS:jitter:GAUGE:600:-1000:1000 \ - DS:noise:GAUGE:600:-1000:1000 \ - DS:stability:GAUGE:600:-1000:1000 \ - DS:uptime:GAUGE:600:0:125000000000 \ - DS:buffer_recv:GAUGE:600:0:100000 \ - DS:buffer_free:GAUGE:600:0:100000 \ - DS:buffer_used:GAUGE:600:0:100000 \ - DS:packets_drop:DERIVE:600:0:125000000000 \ - DS:packets_ignore:DERIVE:600:0:125000000000 \ - DS:packets_recv:DERIVE:600:0:125000000000 \ + '--step 300 + DS:stratum:GAUGE:600:-1000:1000 + DS:offset:GAUGE:600:-1000:1000 + DS:frequency:GAUGE:600:-1000:1000 + DS:jitter:GAUGE:600:-1000:1000 + DS:noise:GAUGE:600:-1000:1000 + DS:stability:GAUGE:600:-1000:1000 + DS:uptime:GAUGE:600:0:125000000000 + DS:buffer_recv:GAUGE:600:0:100000 + DS:buffer_free:GAUGE:600:0:100000 + DS:buffer_used:GAUGE:600:0:100000 + DS:packets_drop:DERIVE:600:0:125000000000 + DS:packets_ignore:DERIVE:600:0:125000000000 + DS:packets_recv:DERIVE:600:0:125000000000 DS:packets_sent:DERIVE:600:0:125000000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/applications/powerdns.inc.php b/includes/polling/applications/powerdns.inc.php index e37acbf5e..94e0076fb 100644 --- a/includes/polling/applications/powerdns.inc.php +++ b/includes/polling/applications/powerdns.inc.php @@ -18,28 +18,28 @@ list ($corrupt, $def_cacheInserts, $def_cacheLookup, $latency, $pc_hit, if (!is_file($rrd_filename)) { rrdtool_create( $rrd_filename, - '--step 300 \ - DS:corruptPackets:DERIVE:600:0:125000000000 \ - DS:def_cacheInserts:DERIVE:600:0:125000000000 \ - DS:def_cacheLookup:DERIVE:600:0:125000000000 \ - DS:latency:DERIVE:600:0:125000000000 \ - DS:pc_hit:DERIVE:600:0:125000000000 \ - DS:pc_miss:DERIVE:600:0:125000000000 \ - DS:pc_size:DERIVE:600:0:125000000000 \ - DS:qsize:DERIVE:600:0:125000000000 \ - DS:qc_hit:DERIVE:600:0:125000000000 \ - DS:qc_miss:DERIVE:600:0:125000000000 \ - DS:rec_answers:DERIVE:600:0:125000000000 \ - DS:rec_questions:DERIVE:600:0:125000000000 \ - DS:servfailPackets:DERIVE:600:0:125000000000 \ - DS:q_tcpAnswers:DERIVE:600:0:125000000000 \ - DS:q_tcpQueries:DERIVE:600:0:125000000000 \ - DS:q_timedout:DERIVE:600:0:125000000000 \ - DS:q_udpAnswers:DERIVE:600:0:125000000000 \ - DS:q_udpQueries:DERIVE:600:0:125000000000 \ - DS:q_udp4Answers:DERIVE:600:0:125000000000 \ - DS:q_udp4Queries:DERIVE:600:0:125000000000 \ - DS:q_udp6Answers:DERIVE:600:0:125000000000 \ + '--step 300 + DS:corruptPackets:DERIVE:600:0:125000000000 + DS:def_cacheInserts:DERIVE:600:0:125000000000 + DS:def_cacheLookup:DERIVE:600:0:125000000000 + DS:latency:DERIVE:600:0:125000000000 + DS:pc_hit:DERIVE:600:0:125000000000 + DS:pc_miss:DERIVE:600:0:125000000000 + DS:pc_size:DERIVE:600:0:125000000000 + DS:qsize:DERIVE:600:0:125000000000 + DS:qc_hit:DERIVE:600:0:125000000000 + DS:qc_miss:DERIVE:600:0:125000000000 + DS:rec_answers:DERIVE:600:0:125000000000 + DS:rec_questions:DERIVE:600:0:125000000000 + DS:servfailPackets:DERIVE:600:0:125000000000 + DS:q_tcpAnswers:DERIVE:600:0:125000000000 + DS:q_tcpQueries:DERIVE:600:0:125000000000 + DS:q_timedout:DERIVE:600:0:125000000000 + DS:q_udpAnswers:DERIVE:600:0:125000000000 + DS:q_udpQueries:DERIVE:600:0:125000000000 + DS:q_udp4Answers:DERIVE:600:0:125000000000 + DS:q_udp4Queries:DERIVE:600:0:125000000000 + DS:q_udp6Answers:DERIVE:600:0:125000000000 DS:q_udp6Queries:DERIVE:600:0:125000000000 '.$config['rrd_rra'] ); }//end if diff --git a/includes/polling/applications/proxmox.inc.php b/includes/polling/applications/proxmox.inc.php index 64668f526..37f8d8cd4 100644 --- a/includes/polling/applications/proxmox.inc.php +++ b/includes/polling/applications/proxmox.inc.php @@ -63,8 +63,8 @@ if (count($pmxlines) > 2) { if (!is_file($rrd_filename)) { rrdtool_create( $rrd_filename, - ' --step 300 \ - DS:INOCTETS:DERIVE:600:0:12500000000 \ + ' --step 300 + DS:INOCTETS:DERIVE:600:0:12500000000 DS:OUTOCTETS:DERIVE:600:0:12500000000 '.$config['rrd_rra']); } diff --git a/includes/polling/applications/shoutcast.inc.php b/includes/polling/applications/shoutcast.inc.php index 2a9600847..4cdd59324 100644 --- a/includes/polling/applications/shoutcast.inc.php +++ b/includes/polling/applications/shoutcast.inc.php @@ -29,14 +29,14 @@ foreach ($servers as $item => $server) { if (!is_file($rrdfile)) { rrdtool_create( $rrdfile, - '--step 300 \ - DS:bitrate:GAUGE:600:0:125000000000 \ - DS:traf_in:GAUGE:600:0:125000000000 \ - DS:traf_out:GAUGE:600:0:125000000000 \ - DS:current:GAUGE:600:0:125000000000 \ - DS:status:GAUGE:600:0:125000000000 \ - DS:peak:GAUGE:600:0:125000000000 \ - DS:max:GAUGE:600:0:125000000000 \ + '--step 300 + DS:bitrate:GAUGE:600:0:125000000000 + DS:traf_in:GAUGE:600:0:125000000000 + DS:traf_out:GAUGE:600:0:125000000000 + DS:current:GAUGE:600:0:125000000000 + DS:status:GAUGE:600:0:125000000000 + DS:peak:GAUGE:600:0:125000000000 + DS:max:GAUGE:600:0:125000000000 DS:unique:GAUGE:600:0:125000000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/applications/tinydns.inc.php b/includes/polling/applications/tinydns.inc.php index 294fcdbc8..903246ad5 100644 --- a/includes/polling/applications/tinydns.inc.php +++ b/includes/polling/applications/tinydns.inc.php @@ -30,26 +30,26 @@ if (!empty($agent_data['app']['tinydns']) && $app['app_id'] > 0) { if (!is_file($rrd_filename)) { rrdtool_create( $rrd_filename, - '--step 300 \ - DS:a:COUNTER:600:0:125000000000 \ - DS:ns:COUNTER:600:0:125000000000 \ - DS:cname:COUNTER:600:0:125000000000 \ - DS:soa:COUNTER:600:0:125000000000 \ - DS:ptr:COUNTER:600:0:125000000000 \ - DS:hinfo:COUNTER:600:0:125000000000 \ - DS:mx:COUNTER:600:0:125000000000 \ - DS:txt:COUNTER:600:0:125000000000 \ - DS:rp:COUNTER:600:0:125000000000 \ - DS:sig:COUNTER:600:0:125000000000 \ - DS:key:COUNTER:600:0:125000000000 \ - DS:aaaa:COUNTER:600:0:125000000000 \ - DS:axfr:COUNTER:600:0:125000000000 \ - DS:any:COUNTER:600:0:125000000000 \ - DS:total:COUNTER:600:0:125000000000 \ - DS:other:COUNTER:600:0:125000000000 \ - DS:notauth:COUNTER:600:0:125000000000 \ - DS:notimpl:COUNTER:600:0:125000000000 \ - DS:badclass:COUNTER:600:0:125000000000 \ + '--step 300 + DS:a:COUNTER:600:0:125000000000 + DS:ns:COUNTER:600:0:125000000000 + DS:cname:COUNTER:600:0:125000000000 + DS:soa:COUNTER:600:0:125000000000 + DS:ptr:COUNTER:600:0:125000000000 + DS:hinfo:COUNTER:600:0:125000000000 + DS:mx:COUNTER:600:0:125000000000 + DS:txt:COUNTER:600:0:125000000000 + DS:rp:COUNTER:600:0:125000000000 + DS:sig:COUNTER:600:0:125000000000 + DS:key:COUNTER:600:0:125000000000 + DS:aaaa:COUNTER:600:0:125000000000 + DS:axfr:COUNTER:600:0:125000000000 + DS:any:COUNTER:600:0:125000000000 + DS:total:COUNTER:600:0:125000000000 + DS:other:COUNTER:600:0:125000000000 + DS:notauth:COUNTER:600:0:125000000000 + DS:notimpl:COUNTER:600:0:125000000000 + DS:badclass:COUNTER:600:0:125000000000 DS:noquery:COUNTER:600:0:125000000000 '.$config['rrd_rra'] ); }//end if diff --git a/includes/polling/bgp-peers.inc.php b/includes/polling/bgp-peers.inc.php index fd371bf13..1d9bff20c 100644 --- a/includes/polling/bgp-peers.inc.php +++ b/includes/polling/bgp-peers.inc.php @@ -142,10 +142,10 @@ if ($config['enable_bgp']) { $peerrrd = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('bgp-'.$peer['bgpPeerIdentifier'].'.rrd'); if (!is_file($peerrrd)) { - $create_rrd = 'DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000 \ - DS:bgpPeerInUpdates:COUNTER:600:U:100000000000 \ - DS:bgpPeerOutTotal:COUNTER:600:U:100000000000 \ - DS:bgpPeerInTotal:COUNTER:600:U:100000000000 \ + $create_rrd = 'DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000 + DS:bgpPeerInUpdates:COUNTER:600:U:100000000000 + DS:bgpPeerOutTotal:COUNTER:600:U:100000000000 + DS:bgpPeerInTotal:COUNTER:600:U:100000000000 DS:bgpPeerEstablished:GAUGE:600:0:U '.$config['rrd_rra']; rrdtool_create($peerrrd, $create_rrd); @@ -305,10 +305,10 @@ if ($config['enable_bgp']) { $cbgp_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('cbgp-'.$peer['bgpPeerIdentifier'].".$afi.$safi.rrd"); if (!is_file($cbgp_rrd)) { - $rrd_create = 'DS:AcceptedPrefixes:GAUGE:600:U:100000000000 \ - DS:DeniedPrefixes:GAUGE:600:U:100000000000 \ - DS:AdvertisedPrefixes:GAUGE:600:U:100000000000 \ - DS:SuppressedPrefixes:GAUGE:600:U:100000000000 \ + $rrd_create = 'DS:AcceptedPrefixes:GAUGE:600:U:100000000000 + DS:DeniedPrefixes:GAUGE:600:U:100000000000 + DS:AdvertisedPrefixes:GAUGE:600:U:100000000000 + DS:SuppressedPrefixes:GAUGE:600:U:100000000000 DS:WithdrawnPrefixes:GAUGE:600:U:100000000000 '.$config['rrd_rra']; rrdtool_create($cbgp_rrd, $rrd_create); } diff --git a/includes/polling/cisco-cef.inc.php b/includes/polling/cisco-cef.inc.php index b105746c1..029c42ed0 100644 --- a/includes/polling/cisco-cef.inc.php +++ b/includes/polling/cisco-cef.inc.php @@ -52,9 +52,9 @@ if ($device['os_group'] == 'cisco') { if (!is_file($filename)) { rrdtool_create( $filename, - '--step 300 \ - DS:drop:DERIVE:600:0:1000000 \ - DS:punt:DERIVE:600:0:1000000 \ + '--step 300 + DS:drop:DERIVE:600:0:1000000 + DS:punt:DERIVE:600:0:1000000 DS:hostpunt:DERIVE:600:0:1000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/cisco-mac-accounting.inc.php b/includes/polling/cisco-mac-accounting.inc.php index ccb5eb6ad..f2bad6241 100644 --- a/includes/polling/cisco-mac-accounting.inc.php +++ b/includes/polling/cisco-mac-accounting.inc.php @@ -65,9 +65,9 @@ if ($device['os_group'] == 'cisco') { if (!is_file($rrdfile)) { rrdtool_create( $rrdfile, - 'DS:IN:COUNTER:600:0:12500000000 \ - DS:OUT:COUNTER:600:0:12500000000 \ - DS:PIN:COUNTER:600:0:12500000000 \ + 'DS:IN:COUNTER:600:0:12500000000 + DS:OUT:COUNTER:600:0:12500000000 + DS:PIN:COUNTER:600:0:12500000000 DS:POUT:COUNTER:600:0:12500000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/cisco-sla.inc.php b/includes/polling/cisco-sla.inc.php index 95938e112..6247f8ede 100644 --- a/includes/polling/cisco-sla.inc.php +++ b/includes/polling/cisco-sla.inc.php @@ -42,7 +42,7 @@ foreach (dbFetchRows('SELECT * FROM `slas` WHERE `device_id` = ? AND `deleted` = if (!is_file($slarrd)) { rrdtool_create( $slarrd, - '--step 300 \ + '--step 300 DS:rtt:GAUGE:600:0:300000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/entity-physical.inc.php b/includes/polling/entity-physical.inc.php index c07e237f1..d608375ff 100644 --- a/includes/polling/entity-physical.inc.php +++ b/includes/polling/entity-physical.inc.php @@ -39,11 +39,11 @@ if ($device['os'] == 'ios') { if (!is_file($rrd)) { rrdtool_create( $rrd, - '--step 300 \ - DS:inutil:GAUGE:600:0:100 \ - DS:oututil:GAUGE:600:0:100 \ - DS:outdropped:DERIVE:600:0:125000000000 \ - DS:outerrors:DERIVE:600:0:125000000000 \ + '--step 300 + DS:inutil:GAUGE:600:0:100 + DS:oututil:GAUGE:600:0:100 + DS:outdropped:DERIVE:600:0:125000000000 + DS:outerrors:DERIVE:600:0:125000000000 DS:inerrors:DERIVE:600:0:125000000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index ffe79340e..927163bad 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -96,7 +96,7 @@ function poll_sensor($device, $class, $unit) { if (!is_file($rrd_file)) { rrdtool_create( $rrd_file, - '--step 300 \ + '--step 300 DS:sensor:GAUGE:600:-20000:20000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/hr-mib.inc.php b/includes/polling/hr-mib.inc.php index ff802563e..7edcd8c01 100644 --- a/includes/polling/hr-mib.inc.php +++ b/includes/polling/hr-mib.inc.php @@ -12,7 +12,7 @@ if (is_numeric($hrSystem[0]['hrSystemProcesses'])) { if (!is_file($rrd_file)) { rrdtool_create( $rrd_file, - '--step 300 \ + '--step 300 DS:procs:GAUGE:600:0:U '.$config['rrd_rra'] ); } @@ -31,7 +31,7 @@ if (is_numeric($hrSystem[0]['hrSystemNumUsers'])) { if (!is_file($rrd_file)) { rrdtool_create( $rrd_file, - '--step 300 \ + '--step 300 DS:users:GAUGE:600:0:U '.$config['rrd_rra'] ); } diff --git a/includes/polling/ipmi.inc.php b/includes/polling/ipmi.inc.php index 519dcb600..dffd19277 100644 --- a/includes/polling/ipmi.inc.php +++ b/includes/polling/ipmi.inc.php @@ -36,7 +36,7 @@ if ($ipmi['host'] = get_dev_attrib($device, 'ipmi_hostname')) { if (!is_file($rrd_file)) { rrdtool_create( $rrd_file, - '--step 300 \ + '--step 300 DS:sensor:GAUGE:600:-20000:20000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/junose-atm-vp.inc.php b/includes/polling/junose-atm-vp.inc.php index 64ba4eed2..b7bbd4acf 100644 --- a/includes/polling/junose-atm-vp.inc.php +++ b/includes/polling/junose-atm-vp.inc.php @@ -36,15 +36,15 @@ if (count($vp_rows)) { if (!is_file($rrd)) { rrdtool_create( $rrd, - '--step 300 \ - DS:incells:DERIVE:600:0:125000000000 \ - DS:outcells:DERIVE:600:0:125000000000 \ - DS:inpackets:DERIVE:600:0:125000000000 \ - DS:outpackets:DERIVE:600:0:125000000000 \ - DS:inpacketoctets:DERIVE:600:0:125000000000 \ - DS:outpacketoctets:DERIVE:600:0:125000000000 \ - DS:inpacketerrors:DERIVE:600:0:125000000000 \ - DS:outpacketerrors:DERIVE:600:0:125000000000 \ + '--step 300 + DS:incells:DERIVE:600:0:125000000000 + DS:outcells:DERIVE:600:0:125000000000 + DS:inpackets:DERIVE:600:0:125000000000 + DS:outpackets:DERIVE:600:0:125000000000 + DS:inpacketoctets:DERIVE:600:0:125000000000 + DS:outpacketoctets:DERIVE:600:0:125000000000 + DS:inpacketerrors:DERIVE:600:0:125000000000 + DS:outpacketerrors:DERIVE:600:0:125000000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/os/procurve.inc.php b/includes/polling/os/procurve.inc.php index 010f0e4d0..0b124dee0 100644 --- a/includes/polling/os/procurve.inc.php +++ b/includes/polling/os/procurve.inc.php @@ -39,7 +39,7 @@ if (is_numeric($FdbAddressCount)) { if (!is_file($fdb_rrd_file)) { rrdtool_create( $fdb_rrd_file, - ' --step 300 \ + ' --step 300 DS:value:GAUGE:600:-1:100000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/os/screenos.inc.php b/includes/polling/os/screenos.inc.php index fa72fe0b9..7fd9297ae 100644 --- a/includes/polling/os/screenos.inc.php +++ b/includes/polling/os/screenos.inc.php @@ -12,9 +12,9 @@ list ($sessalloc, $sessmax, $sessfailed) = explode("\n", $sess_data); if (!is_file($sessrrd)) { rrdtool_create( $sessrrd, - ' --step 300 \ - DS:allocate:GAUGE:600:0:3000000 \ - DS:max:GAUGE:600:0:3000000 \ + ' --step 300 + DS:allocate:GAUGE:600:0:3000000 + DS:max:GAUGE:600:0:3000000 DS:failed:GAUGE:600:0:1000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/os/snom.inc.php b/includes/polling/os/snom.inc.php index e7f5df80f..ac446fa1c 100644 --- a/includes/polling/os/snom.inc.php +++ b/includes/polling/os/snom.inc.php @@ -27,11 +27,11 @@ $rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/data.rrd'; if (!is_file($rrdfile)) { rrdtool_create( $rrdfile, - 'DS:INOCTETS:COUNTER:600:U:100000000000 \ - DS:OUTOCTETS:COUNTER:600:U:10000000000 \ - DS:INPKTS:COUNTER:600:U:10000000000 \ - DS:OUTPKTS:COUNTER:600:U:10000000000 \ - DS:CALLS:COUNTER:600:U:10000000000 \ + 'DS:INOCTETS:COUNTER:600:U:100000000000 + DS:OUTOCTETS:COUNTER:600:U:10000000000 + DS:INPKTS:COUNTER:600:U:10000000000 + DS:OUTPKTS:COUNTER:600:U:10000000000 + DS:CALLS:COUNTER:600:U:10000000000 DS:REGISTRATIONS:COUNTER:600:U:10000000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/ospf.inc.php b/includes/polling/ospf.inc.php index 05501f386..fb5e4b561 100644 --- a/includes/polling/ospf.inc.php +++ b/includes/polling/ospf.inc.php @@ -362,10 +362,10 @@ $filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('ospf-statis if (!is_file($filename)) { rrdtool_create( $filename, - '--step 300 \ - DS:instances:GAUGE:600:0:1000000 \ - DS:areas:GAUGE:600:0:1000000 \ - DS:ports:GAUGE:600:0:1000000 \ + '--step 300 + DS:instances:GAUGE:600:0:1000000 + DS:areas:GAUGE:600:0:1000000 + DS:ports:GAUGE:600:0:1000000 DS:neighbours:GAUGE:600:0:1000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index b0d61a564..cea5abca4 100644 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -474,21 +474,21 @@ foreach ($ports as $port) { if (!is_file($rrdfile)) { rrdtool_create( $rrdfile, - ' --step 300 \ - DS:INOCTETS:DERIVE:600:0:12500000000 \ - DS:OUTOCTETS:DERIVE:600:0:12500000000 \ - DS:INERRORS:DERIVE:600:0:12500000000 \ - DS:OUTERRORS:DERIVE:600:0:12500000000 \ - DS:INUCASTPKTS:DERIVE:600:0:12500000000 \ - DS:OUTUCASTPKTS:DERIVE:600:0:12500000000 \ - DS:INNUCASTPKTS:DERIVE:600:0:12500000000 \ - DS:OUTNUCASTPKTS:DERIVE:600:0:12500000000 \ - DS:INDISCARDS:DERIVE:600:0:12500000000 \ - DS:OUTDISCARDS:DERIVE:600:0:12500000000 \ - DS:INUNKNOWNPROTOS:DERIVE:600:0:12500000000 \ - DS:INBROADCASTPKTS:DERIVE:600:0:12500000000 \ - DS:OUTBROADCASTPKTS:DERIVE:600:0:12500000000 \ - DS:INMULTICASTPKTS:DERIVE:600:0:12500000000 \ + ' --step 300 + DS:INOCTETS:DERIVE:600:0:12500000000 + DS:OUTOCTETS:DERIVE:600:0:12500000000 + DS:INERRORS:DERIVE:600:0:12500000000 + DS:OUTERRORS:DERIVE:600:0:12500000000 + DS:INUCASTPKTS:DERIVE:600:0:12500000000 + DS:OUTUCASTPKTS:DERIVE:600:0:12500000000 + DS:INNUCASTPKTS:DERIVE:600:0:12500000000 + DS:OUTNUCASTPKTS:DERIVE:600:0:12500000000 + DS:INDISCARDS:DERIVE:600:0:12500000000 + DS:OUTDISCARDS:DERIVE:600:0:12500000000 + DS:INUNKNOWNPROTOS:DERIVE:600:0:12500000000 + DS:INBROADCASTPKTS:DERIVE:600:0:12500000000 + DS:OUTBROADCASTPKTS:DERIVE:600:0:12500000000 + DS:INMULTICASTPKTS:DERIVE:600:0:12500000000 DS:OUTMULTICASTPKTS:DERIVE:600:0:12500000000 '.$config['rrd_rra'] ); }//end if diff --git a/includes/polling/processors.inc.php b/includes/polling/processors.inc.php index dfe2aa39c..fb92e4135 100644 --- a/includes/polling/processors.inc.php +++ b/includes/polling/processors.inc.php @@ -16,7 +16,7 @@ foreach (dbFetchRows('SELECT * FROM processors WHERE device_id = ?', array($devi if (!is_file($procrrd)) { rrdtool_create( $procrrd, - '--step 300 \ + '--step 300 DS:usage:GAUGE:600:-273:1000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/toner.inc.php b/includes/polling/toner.inc.php index 9b3c32cb3..202cee429 100644 --- a/includes/polling/toner.inc.php +++ b/includes/polling/toner.inc.php @@ -23,7 +23,7 @@ if ($config['enable_printers']) { if (!is_file($tonerrrd)) { rrdtool_create( $tonerrrd, - '--step 300 \ + '--step 300 DS:toner:GAUGE:600:0:20000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/ucd-diskio.inc.php b/includes/polling/ucd-diskio.inc.php index f7e197551..8a3bae0c0 100644 --- a/includes/polling/ucd-diskio.inc.php +++ b/includes/polling/ucd-diskio.inc.php @@ -24,10 +24,10 @@ if (count($diskio_data)) { if (!is_file($rrd)) { rrdtool_create( $rrd, - '--step 300 \ - DS:read:DERIVE:600:0:125000000000 \ - DS:written:DERIVE:600:0:125000000000 \ - DS:reads:DERIVE:600:0:125000000000 \ + '--step 300 + DS:read:DERIVE:600:0:125000000000 + DS:written:DERIVE:600:0:125000000000 + DS:reads:DERIVE:600:0:125000000000 DS:writes:DERIVE:600:0:125000000000 '.$config['rrd_rra'] ); } diff --git a/includes/polling/ucd-mib.inc.php b/includes/polling/ucd-mib.inc.php index 350a28204..93f9f9e56 100644 --- a/includes/polling/ucd-mib.inc.php +++ b/includes/polling/ucd-mib.inc.php @@ -34,10 +34,10 @@ $ss = snmpwalk_cache_oid($device, 'systemStats', array(), 'UCD-SNMP-MIB'); $ss = $ss[0]; // Insert Nazi joke here. // Create CPU RRD if it doesn't already exist -$cpu_rrd_create = ' --step 300 \ - DS:user:COUNTER:600:0:U \ - DS:system:COUNTER:600:0:U \ - DS:nice:COUNTER:600:0:U \ +$cpu_rrd_create = ' --step 300 + DS:user:COUNTER:600:0:U + DS:system:COUNTER:600:0:U + DS:nice:COUNTER:600:0:U DS:idle:COUNTER:600:0:U '.$config['rrd_rra']; // This is how we currently collect. We should collect one RRD per stat, for ease of handling differen formats, @@ -125,14 +125,14 @@ if (is_numeric($ss['ssRawInterrupts'])) { // UCD-SNMP-MIB::memCached.0 = INTEGER: 2595556 kB // UCD-SNMP-MIB::memSwapError.0 = INTEGER: noError(0) // UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING: -$mem_rrd_create = ' --step 300 \ - DS:totalswap:GAUGE:600:0:10000000000 \ - DS:availswap:GAUGE:600:0:10000000000 \ - DS:totalreal:GAUGE:600:0:10000000000 \ - DS:availreal:GAUGE:600:0:10000000000 \ - DS:totalfree:GAUGE:600:0:10000000000 \ - DS:shared:GAUGE:600:0:10000000000 \ - DS:buffered:GAUGE:600:0:10000000000 \ +$mem_rrd_create = ' --step 300 + DS:totalswap:GAUGE:600:0:10000000000 + DS:availswap:GAUGE:600:0:10000000000 + DS:totalreal:GAUGE:600:0:10000000000 + DS:availreal:GAUGE:600:0:10000000000 + DS:totalfree:GAUGE:600:0:10000000000 + DS:shared:GAUGE:600:0:10000000000 + DS:buffered:GAUGE:600:0:10000000000 DS:cached:GAUGE:600:0:10000000000 '.$config['rrd_rra']; $snmpdata = snmp_get_multi($device, 'memTotalSwap.0 memAvailSwap.0 memTotalReal.0 memAvailReal.0 memTotalFree.0 memShared.0 memBuffer.0 memCached.0', '-OQUs', 'UCD-SNMP-MIB'); diff --git a/includes/polling/wifi.inc.php b/includes/polling/wifi.inc.php index 13ce8a232..2b52c7f77 100644 --- a/includes/polling/wifi.inc.php +++ b/includes/polling/wifi.inc.php @@ -74,7 +74,7 @@ if ($device['type'] == 'network' || $device['type'] == 'firewall' || $device['ty if (!is_file($wificlientsrrd)) { rrdtool_create( $wificlientsrrd, - '--step 300 \ + '--step 300 DS:wificlients:GAUGE:600:-273:1000 '.$config['rrd_rra'] ); } @@ -94,7 +94,7 @@ if ($device['type'] == 'network' || $device['type'] == 'firewall' || $device['ty if (!is_file($wificlientsrrd)) { rrdtool_create( $wificlientsrrd, - '--step 300 \ + '--step 300 DS:wificlients:GAUGE:600:-273:1000 '.$config['rrd_rra'] ); } diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index 8123a654d..49145dcfc 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -166,7 +166,7 @@ function rrdtool_graph($graph_file, $options) { function rrdtool($command, $filename, $options) { global $config, $debug, $rrd_pipes, $console_color; - if ($config['rrdtool_version'] >= 1.5 && $config['rrdcached']) { + if ($config['rrdcached'] && ($config['rrdtool_version'] >= 1.5 || $command != "create")) { if (isset($config['rrdcached_dir']) && $config['rrdcached_dir'] !== false) { $filename = str_replace($config['rrd_dir'].'/', './'.$config['rrdcached_dir'].'/', $filename); $filename = str_replace($config['rrd_dir'], './'.$config['rrdcached_dir'].'/', $filename); From afd83f6a8d79488a6c2c0646ac08703f698b329a Mon Sep 17 00:00:00 2001 From: f0o Date: Mon, 28 Sep 2015 09:05:44 +0000 Subject: [PATCH 19/40] Strip newlines from arguments on creation --- includes/rrdtool.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index 49145dcfc..1c12f7e39 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -206,7 +206,7 @@ function rrdtool($command, $filename, $options) { function rrdtool_create($filename, $options) { - return rrdtool('create', $filename, $options); + return rrdtool('create', $filename, str_replace(array("\r", "\n"), '', $options)); } From 52ceafbcbbfb715b32f5cb7600b4d1f92f5ff405 Mon Sep 17 00:00:00 2001 From: Tamas Szabo Date: Tue, 29 Sep 2015 15:20:47 +0300 Subject: [PATCH 20/40] OpenWrt support added to distro detection script --- scripts/distro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/distro b/scripts/distro index 0b31916b9..88b2fda39 100755 --- a/scripts/distro +++ b/scripts/distro @@ -52,6 +52,10 @@ elif [ "${OS}" = "Linux" ] ; then elif [ -f /etc/os-release ] ; then DIST=$(grep '^NAME=' /etc/os-release | cut -d= -f2- | tr -d '"') REV=$(grep '^VERSION_ID=' /etc/os-release | cut -d= -f2- | tr -d '"') + + elif [ -f /etc/openwrt_version ] ; then + DIST="OpenWrt" + REV=$(cat /etc/openwrt_version) fi if [ -f /etc/lsb-release -a "${IGNORE_LSB}" != 1 ] ; then From a86988605de55df6dd1d37a1d1bba18f5986730e Mon Sep 17 00:00:00 2001 From: Alan Gregory Date: Tue, 29 Sep 2015 09:50:34 -0300 Subject: [PATCH 21/40] Added Full screen Mobile support --- html/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/html/index.php b/html/index.php index 37cff02ea..c21b204d4 100644 --- a/html/index.php +++ b/html/index.php @@ -121,6 +121,7 @@ if (empty($config['favicon'])) { + Date: Tue, 29 Sep 2015 15:14:53 +0200 Subject: [PATCH 22/40] - added PLD Linux support to distro script --- scripts/distro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/distro b/scripts/distro index 88b2fda39..a9163da15 100755 --- a/scripts/distro +++ b/scripts/distro @@ -56,6 +56,10 @@ elif [ "${OS}" = "Linux" ] ; then elif [ -f /etc/openwrt_version ] ; then DIST="OpenWrt" REV=$(cat /etc/openwrt_version) + + elif [ -f /etc/pld-release ] ; then + DIST=$(cat /etc/pld-release) + REV="" fi if [ -f /etc/lsb-release -a "${IGNORE_LSB}" != 1 ] ; then From 75119b111c4ee32facfb40e4926f1aaef0dda79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Paszkiewicz?= Date: Tue, 29 Sep 2015 15:36:16 +0200 Subject: [PATCH 23/40] - I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 694329cd8..6ae497f9e 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -56,5 +56,6 @@ Contributors to LibreNMS: - Christophe Martinet (chrisgfx) - Nils Steinger (n-st) - Mark Nagel (ciscoqid) +- Sławomir Paszkiewicz (paszczus) [1]: http://observium.org/ "Observium web site" From afdbb2406d8108d2cbfcf0ba12ef42015667bc96 Mon Sep 17 00:00:00 2001 From: Daniel Preussker Date: Wed, 30 Sep 2015 15:20:06 +0000 Subject: [PATCH 24/40] Added `$nocache` parameter Fixed typo in caching Excluded caching for MySQL-Authentication & /poll-log/ --- html/includes/authentication/mysql.inc.php | 14 +++++----- html/includes/table/poll-log.inc.php | 2 +- html/index.php | 4 ++- includes/dbFacile.mysql.php | 24 ++++++++--------- includes/dbFacile.mysqli.php | 30 +++++++++++----------- includes/definitions.inc.php | 7 +++-- 6 files changed, 41 insertions(+), 40 deletions(-) diff --git a/html/includes/authentication/mysql.inc.php b/html/includes/authentication/mysql.inc.php index 84e119cea..c16e716f8 100644 --- a/html/includes/authentication/mysql.inc.php +++ b/html/includes/authentication/mysql.inc.php @@ -3,7 +3,7 @@ function authenticate($username, $password) { $encrypted_old = md5($password); - $row = dbFetchRow('SELECT username,password FROM `users` WHERE `username`= ?', array($username)); + $row = dbFetchRow('SELECT username,password FROM `users` WHERE `username`= ?', array($username), true); if ($row['username'] && $row['username'] == $username) { // Migrate from old, unhashed password if ($row['password'] == $encrypted_old) { @@ -36,7 +36,7 @@ function authenticate($username, $password) { function reauthenticate($sess_id, $token) { list($uname,$hash) = explode('|', $token); - $session = dbFetchRow("SELECT * FROM `session` WHERE `session_username` = '$uname' AND session_value='$sess_id'"); + $session = dbFetchRow("SELECT * FROM `session` WHERE `session_username` = '$uname' AND session_value='$sess_id'", array(), true); $hasher = new PasswordHash(8, false); if ($hasher->CheckPassword($uname.$session['session_token'], $hash)) { $_SESSION['username'] = $uname; @@ -59,7 +59,7 @@ function passwordscanchange($username='') { return 1; } else { - return dbFetchCell('SELECT can_modify_passwd FROM users WHERE username = ?', array($username)); + return dbFetchCell('SELECT can_modify_passwd FROM users WHERE username = ?', array($username), true); } }//end passwordscanchange() @@ -114,20 +114,20 @@ function adduser($username, $password, $level, $email='', $realname='', $can_mod function user_exists($username) { - $return = @dbFetchCell('SELECT COUNT(*) FROM users WHERE username = ?', array($username)); + $return = @dbFetchCell('SELECT COUNT(*) FROM users WHERE username = ?', array($username), true); return $return; }//end user_exists() function get_userlevel($username) { - return dbFetchCell('SELECT `level` FROM `users` WHERE `username` = ?', array($username)); + return dbFetchCell('SELECT `level` FROM `users` WHERE `username` = ?', array($username), true); }//end get_userlevel() function get_userid($username) { - return dbFetchCell('SELECT `user_id` FROM `users` WHERE `username` = ?', array($username)); + return dbFetchCell('SELECT `user_id` FROM `users` WHERE `username` = ?', array($username), true); }//end get_userid() @@ -158,7 +158,7 @@ function can_update_users() { function get_user($user_id) { - return dbFetchRow('SELECT * FROM `users` WHERE `user_id` = ?', array($user_id)); + return dbFetchRow('SELECT * FROM `users` WHERE `user_id` = ?', array($user_id), true); }//end get_user() diff --git a/html/includes/table/poll-log.inc.php b/html/includes/table/poll-log.inc.php index 0b0ce89c4..722c47d31 100644 --- a/html/includes/table/poll-log.inc.php +++ b/html/includes/table/poll-log.inc.php @@ -42,7 +42,7 @@ if ($rowCount != -1) { $sql = "SELECT D.device_id,D.hostname AS `hostname`, D.last_polled AS `last_polled`, `group_name`, D.last_polled_timetaken AS `last_polled_timetaken` $sql"; -foreach (dbFetchRows($sql) as $device) { +foreach (dbFetchRows($sql,array(),true) as $device) { if (empty($device['group_name'])) { $device['group_name'] = 'General'; } diff --git a/html/index.php b/html/index.php index 37cff02ea..60a09e494 100644 --- a/html/index.php +++ b/html/index.php @@ -32,7 +32,7 @@ function catchFatal() { } } -if (strpos($_SERVER['PATH_INFO'], "debug")) { +if (strpos($_SERVER['PATH_INFO'], "debug") || true) { $debug = "1"; ini_set('display_errors', 0); ini_set('display_startup_errors', 1); @@ -66,6 +66,8 @@ require 'includes/functions.inc.php'; require 'includes/vars.inc.php'; require 'includes/plugins.inc.php'; +$config['memcached']['ttl'] = $config['time']['now']+300; + Plugins::start(); $runtime_start = utime(); diff --git a/includes/dbFacile.mysql.php b/includes/dbFacile.mysql.php index e51a695b7..bdcce1ac1 100644 --- a/includes/dbFacile.mysql.php +++ b/includes/dbFacile.mysql.php @@ -238,10 +238,10 @@ function dbDelete($table, $where=null, $parameters=array()) { * */ -function dbFetchRows($sql, $parameters=array()) { +function dbFetchRows($sql, $parameters=array(), $nocache=false) { global $db_stats, $config; - if ($config['memcached']['enable']) { + if ($config['memcached']['enable'] && $nocache === false) { $result = $config['memcached']['resource']->get(hash('sha512',$sql.'|'.serialize($parameters))); if (!empty($result)) { return $result; @@ -258,7 +258,7 @@ function dbFetchRows($sql, $parameters=array()) { } mysql_free_result($result); - if ($config['memcached']['enable']) { + if ($config['memcached']['enable'] && $nocache === false) { $config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$rows,$config['memcached']['ttl']); } return $rows; @@ -283,8 +283,8 @@ function dbFetchRows($sql, $parameters=array()) { * */ -function dbFetch($sql, $parameters=array()) { - return dbFetchRows($sql, $parameters); +function dbFetch($sql, $parameters=array(), $nocache=false) { + return dbFetchRows($sql, $parameters, $nocache); /* // for now, don't do the iterator thing $result = dbQuery($sql, $parameters); @@ -305,10 +305,10 @@ function dbFetch($sql, $parameters=array()) { * */ -function dbFetchRow($sql=null, $parameters=array()) { +function dbFetchRow($sql=null, $parameters=array(), $nocache=false) { global $db_stats, $config; - if ($config['memcached']['enable']) { + if ($config['memcached']['enable'] && $nocache === false) { $result = $config['memcached']['resource']->get(hash('sha512',$sql.'|'.serialize($parameters))); if (!empty($result)) { return $result; @@ -325,7 +325,7 @@ function dbFetchRow($sql=null, $parameters=array()) { $db_stats['fetchrow_sec'] += number_format(($time_end - $time_start), 8); $db_stats['fetchrow']++; - if ($config['memcached']['enable']) { + if ($config['memcached']['enable'] && $nocache === false) { $config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$row,$config['memcached']['ttl']); } return $row; @@ -344,10 +344,10 @@ function dbFetchRow($sql=null, $parameters=array()) { * */ -function dbFetchCell($sql, $parameters=array()) { +function dbFetchCell($sql, $parameters=array(), $nocache=false) { global $db_stats; $time_start = microtime(true); - $row = dbFetchRow($sql, $parameters); + $row = dbFetchRow($sql, $parameters, $nocache); if ($row) { return array_shift($row); // shift first field off first row @@ -369,11 +369,11 @@ function dbFetchCell($sql, $parameters=array()) { * */ -function dbFetchColumn($sql, $parameters=array()) { +function dbFetchColumn($sql, $parameters=array(), $nocache=false) { global $db_stats; $time_start = microtime(true); $cells = array(); - foreach (dbFetch($sql, $parameters) as $row) { + foreach (dbFetch($sql, $parameters, $nocache) as $row) { $cells[] = array_shift($row); } diff --git a/includes/dbFacile.mysqli.php b/includes/dbFacile.mysqli.php index e956e78ba..9e49491a6 100644 --- a/includes/dbFacile.mysqli.php +++ b/includes/dbFacile.mysqli.php @@ -239,10 +239,10 @@ function dbDelete($table, $where=null, $parameters=array()) { * */ -function dbFetchRows($sql, $parameters=array()) { +function dbFetchRows($sql, $parameters=array(), $nocache=false) { global $db_stats, $config; - if ($config['memcached']['enable']) { + if ($config['memcached']['enable'] && $nocache === false) { $result = $config['memcached']['resource']->get(hash('sha512',$sql.'|'.serialize($parameters))); if (!empty($result)) { return $result; @@ -259,7 +259,7 @@ function dbFetchRows($sql, $parameters=array()) { } mysqli_free_result($result); - if ($config['memcached']['enable']) { + if ($config['memcached']['enable'] && $nocache === false) { $config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$rows,$config['memcached']['ttl']); } return $rows; @@ -284,8 +284,8 @@ function dbFetchRows($sql, $parameters=array()) { * */ -function dbFetch($sql, $parameters=array()) { - return dbFetchRows($sql, $parameters); +function dbFetch($sql, $parameters=array(), $nocache=false) { + return dbFetchRows($sql, $parameters, $nocache); /* // for now, don't do the iterator thing $result = dbQuery($sql, $parameters); @@ -306,10 +306,10 @@ function dbFetch($sql, $parameters=array()) { * */ -function dbFetchRow($sql=null, $parameters=array()) { +function dbFetchRow($sql=null, $parameters=array(), $nocache=false) { global $db_stats, $config; - if ($config['memcached']['enable']) { + if ($config['memcached']['enable'] && $nocache === false) { $result = $config['memcached']['resource']->get(hash('sha512',$sql.'|'.serialize($parameters))); if (!empty($result)) { return $result; @@ -326,8 +326,8 @@ function dbFetchRow($sql=null, $parameters=array()) { $db_stats['fetchrow_sec'] += number_format(($time_end - $time_start), 8); $db_stats['fetchrow']++; - if ($config['memcached']['enable']) { - $config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$rows,$config['memcached']['ttl']); + if ($config['memcached']['enable'] && $nocache === false) { + $config['memcached']['resource']->set(hash('sha512',$sql.'|'.serialize($parameters)),$row,$config['memcached']['ttl']); } return $row; } @@ -345,11 +345,11 @@ function dbFetchRow($sql=null, $parameters=array()) { * */ -function dbFetchCell($sql, $parameters=array()) { +function dbFetchCell($sql, $parameters=array(), $nocache=false) { global $db_stats, $config; $time_start = microtime(true); - $row = dbFetchRow($sql, $parameters); + $row = dbFetchRow($sql, $parameters, $nocache); if ($row) { return array_shift($row); // shift first field off first row @@ -371,11 +371,11 @@ function dbFetchCell($sql, $parameters=array()) { * */ -function dbFetchColumn($sql, $parameters=array()) { +function dbFetchColumn($sql, $parameters=array(), $nocache=false) { global $db_stats; $time_start = microtime(true); $cells = array(); - foreach (dbFetch($sql, $parameters) as $row) { + foreach (dbFetch($sql, $parameters, $nocache) as $row) { $cells[] = array_shift($row); } @@ -396,9 +396,9 @@ function dbFetchColumn($sql, $parameters=array()) { */ -function dbFetchKeyValue($sql, $parameters=array()) { +function dbFetchKeyValue($sql, $parameters=array(), $nocache=false) { $data = array(); - foreach (dbFetch($sql, $parameters) as $row) { + foreach (dbFetch($sql, $parameters, $nocache) as $row) { $key = array_shift($row); if (sizeof($row) == 1) { // if there were only 2 fields in the result diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index 23f6dd97b..327e5e574 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -30,12 +30,9 @@ else { $database_db = mysql_select_db($config['db_name'], $database_link); } -$config['time']['now'] = time(); -$config['time']['now'] -= ($config['time']['now'] % 300); - if ($config['memcached']['enable'] === true) { if (class_exists('Memcached')) { - $config['memcached']['ttl'] += $config['time']['now']; + $config['memcached']['ttl'] = 60; $config['memcached']['resource'] = new Memcached(); $config['memcached']['resource']->addServer($config['memcached']['host'], $config['memcached']['port']); } @@ -1720,6 +1717,8 @@ if (isset($_SERVER['HTTPS'])) { } // Set some times needed by loads of scripts (it's dynamic, so we do it here!) +$config['time']['now'] = time(); +$config['time']['now'] -= ($config['time']['now'] % 300); $config['time']['fourhour'] = ($config['time']['now'] - 14400); // time() - (4 * 60 * 60); $config['time']['sixhour'] = ($config['time']['now'] - 21600); From dc7ecc0133e84e18df8e902499c5d2b74921f24e Mon Sep 17 00:00:00 2001 From: f0o Date: Wed, 30 Sep 2015 20:11:18 +0000 Subject: [PATCH 25/40] Added bills to graph-widget --- html/ajax_search.php | 11 ++++++ html/includes/common/generic-graph.inc.php | 44 ++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/html/ajax_search.php b/html/ajax_search.php index 7d82a1ac9..13328fce1 100644 --- a/html/ajax_search.php +++ b/html/ajax_search.php @@ -318,6 +318,17 @@ if (isset($_REQUEST['search'])) { $json = json_encode($device); die($json); + } + else if ($_REQUEST['type'] == 'bill') { + // Device search + if (is_admin() === true || is_read() === true) { + $results = dbFetchRows("SELECT `bills`.bill_id, `bills`.bill_name FROM `bills` WHERE `bill_name` LIKE '%".$search."%' OR `bill_notes` LIKE '%".$search."%' LIMIT 8"); + } + else { + $results = dbFetchRows("SELECT `bills`.bill_id, `bills`.bill_name FROM `bills` INNER JOIN `bill_perms` ON `bills`.bill_id = `bill_perms`.bill_id WHERE `bill_perms`.user_id = ? AND (`bill_name` LIKE '%".$search."%' OR `bill_notes` LIKE '%".$search."%')LIMIT 8", array($_SESSION['user_id'], $_SESSION['user_id'])); + } + $json = json_encode($results); + die($json); }//end if }//end if }//end if diff --git a/html/includes/common/generic-graph.inc.php b/html/includes/common/generic-graph.inc.php index e7cf4b9ed..87bb88373 100644 --- a/html/includes/common/generic-graph.inc.php +++ b/html/includes/common/generic-graph.inc.php @@ -66,6 +66,8 @@ if( defined('show_settings') || empty($widget_settings) ) { + +
@@ -140,6 +142,14 @@ if( defined('show_settings') || empty($widget_settings) ) { $common_output[] = '
+
+
+ +
+
+ +
+
@@ -301,6 +311,40 @@ function '.$unique_id.'() { } }); + var '.$unique_id.'_bill = new Bloodhound({ + datumTokenizer: Bloodhound.tokenizers.obj.whitespace("munin"), + queryTokenizer: Bloodhound.tokenizers.whitespace, + remote: { + url: "ajax_search.php?search=%QUERY&type=bill", + filter: function (output) { + return $.map(output, function (item) { + return { + name: item.bill_name, + bill_id: item.bill_id, + }; + }); + }, + wildcard: "%QUERY" + } + }); + '.$unique_id.'_bill.initialize(); + $(".input_'.$unique_id.'_bill").typeahead({ + hint: true, + highlight: true, + minLength: 1, + classNames: { + menu: "typeahead-left" + } + }, + { + source: '.$unique_id.'_bill.ttAdapter(), + async: false, + templates: { + header: "
 Bill
", + suggestion: Handlebars.compile(\'

{{name}}

\') + } + }); + switch_'.$unique_id.'($("#select_'.$unique_id.'").val()); } function switch_'.$unique_id.'(data) { From 7aae685323cbed45bb194413bcf08de6e69341a7 Mon Sep 17 00:00:00 2001 From: Arjit Chaudhary Date: Thu, 1 Oct 2015 01:49:00 +0530 Subject: [PATCH 26/40] Fix table --- html/pages/bill/transfer.inc.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/html/pages/bill/transfer.inc.php b/html/pages/bill/transfer.inc.php index 058da6232..889838294 100644 --- a/html/pages/bill/transfer.inc.php +++ b/html/pages/bill/transfer.inc.php @@ -88,9 +88,8 @@ function showPercent($per) { echo '

Bill Summary

'; -echo '

Quota Bill

'; -echo '
'; -echo ' '; +echo '

Quota Bill (Billing Period from '.$fromtext.' to '.$totext.')

'; +echo '
Billing Period from '.$fromtext.' to '.$totext.'
'; echo ' '; echo ' '; echo ' '; From 69d4335b346b293711f2aa1991c3ba7ed8919ba6 Mon Sep 17 00:00:00 2001 From: Arjit Chaudhary Date: Thu, 1 Oct 2015 01:51:55 +0530 Subject: [PATCH 27/40] Fix table --- html/pages/bill/history.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/pages/bill/history.inc.php b/html/pages/bill/history.inc.php index b6ba2551d..26a4750b6 100644 --- a/html/pages/bill/history.inc.php +++ b/html/pages/bill/history.inc.php @@ -40,7 +40,7 @@ function showDetails($bill_id, $imgtype, $from, $to, $bittype='Quota') { // $url = generate_url($vars, array('detail' => 'yes')); $url = $PHP_SELF.'/bill/'.$bill_id.'/history/detail=all/'; -echo '
Bandwidth
+echo '
@@ -93,7 +93,7 @@ foreach (dbFetchRows('SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY echo ' - + From 511f4e90376c039164e8a2f7dbe8d8d80d6c1f07 Mon Sep 17 00:00:00 2001 From: Daniel Preussker Date: Wed, 30 Sep 2015 20:27:12 +0000 Subject: [PATCH 28/40] Excluded more pages from caching --- html/pages/deleted-ports.inc.php | 2 +- html/pages/device/edit.inc.php | 1 + html/pages/settings.inc.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/html/pages/deleted-ports.inc.php b/html/pages/deleted-ports.inc.php index 32b11b304..8f2895281 100644 --- a/html/pages/deleted-ports.inc.php +++ b/html/pages/deleted-ports.inc.php @@ -22,7 +22,7 @@ else if ($vars['purge']) { echo '
Period
'.strftime('%Y-%m-%d', strtotime($datefrom)).' -> '.strftime('%Y-%m-%d', strtotime($dateto))."'.strftime('%Y-%m-%d', strtotime($datefrom)).' to '.strftime('%Y-%m-%d', strtotime($dateto))." $type $allowed $in
'; echo ""; -foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id") as $interface) { +foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id",array(),true) as $interface) { $interface = ifLabel($interface, $interface); if (port_permitted($interface['port_id'], $interface['device_id'])) { echo ''; diff --git a/html/pages/device/edit.inc.php b/html/pages/device/edit.inc.php index 0448ac01d..86cc6d490 100644 --- a/html/pages/device/edit.inc.php +++ b/html/pages/device/edit.inc.php @@ -1,6 +1,7 @@ 'device', 'device' => $device['device_id'], diff --git a/html/pages/settings.inc.php b/html/pages/settings.inc.php index d7170ee97..2f7a9517e 100644 --- a/html/pages/settings.inc.php +++ b/html/pages/settings.inc.php @@ -24,6 +24,7 @@ * @subpackage Page */ $pagetitle[] = 'Global Settings'; +$config['memcached']['enable'] = false; ?>
From c8c9f489cefa15c313a3f4977c77dc989bf4f288 Mon Sep 17 00:00:00 2001 From: f0o Date: Thu, 1 Oct 2015 11:02:15 +0000 Subject: [PATCH 29/40] SQL Typo --- html/ajax_search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/ajax_search.php b/html/ajax_search.php index 13328fce1..fd6675682 100644 --- a/html/ajax_search.php +++ b/html/ajax_search.php @@ -325,7 +325,7 @@ if (isset($_REQUEST['search'])) { $results = dbFetchRows("SELECT `bills`.bill_id, `bills`.bill_name FROM `bills` WHERE `bill_name` LIKE '%".$search."%' OR `bill_notes` LIKE '%".$search."%' LIMIT 8"); } else { - $results = dbFetchRows("SELECT `bills`.bill_id, `bills`.bill_name FROM `bills` INNER JOIN `bill_perms` ON `bills`.bill_id = `bill_perms`.bill_id WHERE `bill_perms`.user_id = ? AND (`bill_name` LIKE '%".$search."%' OR `bill_notes` LIKE '%".$search."%')LIMIT 8", array($_SESSION['user_id'], $_SESSION['user_id'])); + $results = dbFetchRows("SELECT `bills`.bill_id, `bills`.bill_name FROM `bills` INNER JOIN `bill_perms` ON `bills`.bill_id = `bill_perms`.bill_id WHERE `bill_perms`.user_id = ? AND (`bill_name` LIKE '%".$search."%' OR `bill_notes` LIKE '%".$search."%') LIMIT 8", array($_SESSION['user_id'])); } $json = json_encode($results); die($json); From c7062350483dbc78b2515e53ac5f618c28410de6 Mon Sep 17 00:00:00 2001 From: Arjit Chaudhary Date: Thu, 1 Oct 2015 16:53:43 +0530 Subject: [PATCH 30/40] Remove table class/element from here as we use it from bootstrap --- html/css/styles.css | 1 - 1 file changed, 1 deletion(-) diff --git a/html/css/styles.css b/html/css/styles.css index eb646b8b9..c7e55d4e6 100644 --- a/html/css/styles.css +++ b/html/css/styles.css @@ -683,7 +683,6 @@ table.simple { padding: 10px; } -table { border-collapse: collapse; margin: 0px; background-color:#ffffff } form { margin: 0px; padding: 0px; } hr { border: 0px; height: 1px; background-color: #ccc; color: #ccc; } p { margin: 0px; padding: 0px; } From d5259cbdec4b5600467e30a33b7b318365c0b8cd Mon Sep 17 00:00:00 2001 From: Arjit Chaudhary Date: Thu, 1 Oct 2015 17:01:33 +0530 Subject: [PATCH 31/40] Fix fonts Screenshot: http://i.imgur.com/Ga0AUxP.png --- html/pages/graphs.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index 9ca22603a..582aacd71 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -97,7 +97,7 @@ else { $link = generate_url($link_array); echo('
Purge All
'); - echo(''.$text.'
'); + echo(''.$text.'
'); echo(''); echo generate_lazy_graph_tag($graph_array); echo(''); From 2e37b187b261841ca13e68c34a196eaa93a4e6f9 Mon Sep 17 00:00:00 2001 From: Arjit Chaudhary Date: Thu, 1 Oct 2015 18:02:42 +0530 Subject: [PATCH 32/40] Set background for minigraph to white as we've removed it from styles.css --- html/includes/functions.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 67d062b4c..2a1ca4dd6 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -222,7 +222,7 @@ function generate_device_link($device, $text=null, $vars=array(), $start=0, $end $url = generate_device_url($device, $vars); // beginning of overlib box contains large hostname followed by hardware & OS details - $contents = '
'.$device['hostname'].''; + $contents = '
'.$device['hostname'].''; if ($device['hardware']) { $contents .= ' - '.$device['hardware']; } @@ -248,7 +248,7 @@ function generate_device_link($device, $text=null, $vars=array(), $start=0, $end foreach ($graphs as $entry) { $graph = $entry['graph']; $graphhead = $entry['text']; - $contents .= '
'; + $contents .= '
'; $contents .= ''.$graphhead.'
'; $contents .= generate_minigraph_image($device, $start, $end, $graph); $contents .= generate_minigraph_image($device, $config['time']['week'], $end, $graph); From 5806850bce9810432cdb3a78dcca1d4771829bed Mon Sep 17 00:00:00 2001 From: f0o Date: Thu, 1 Oct 2015 15:20:46 +0000 Subject: [PATCH 33/40] Soft-Fail if PEAR doesnt exist --- html/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/install.php b/html/install.php index 8dbfde4c4..2890b83ef 100644 --- a/html/install.php +++ b/html/install.php @@ -216,7 +216,7 @@ if($stage == 0) { } // Check for pear install - require_once 'System.php'; + @include_once 'System.php'; if(class_exists('System') === true) { $ext_loaded = 'yes'; From 04faec2d166e73fdef8f69e36052801e5cad3030 Mon Sep 17 00:00:00 2001 From: Frederik Mogensen Date: Mon, 28 Sep 2015 23:10:36 +0200 Subject: [PATCH 34/40] Added graphs for number of APs and number of Clients attached to the APs --- .../graphs/device/ciscowlc_numaps.inc.php | 20 ++++++++ .../graphs/device/ciscowlc_numclients.inc.php | 21 ++++++++ includes/definitions.inc.php | 4 ++ includes/polling/os/ciscowlc.inc.php | 51 +++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 html/includes/graphs/device/ciscowlc_numaps.inc.php create mode 100644 html/includes/graphs/device/ciscowlc_numclients.inc.php diff --git a/html/includes/graphs/device/ciscowlc_numaps.inc.php b/html/includes/graphs/device/ciscowlc_numaps.inc.php new file mode 100644 index 000000000..c8507252f --- /dev/null +++ b/html/includes/graphs/device/ciscowlc_numaps.inc.php @@ -0,0 +1,20 @@ + $value) { + $numClients += $value['bsnApIfNoOfUsers']; +} + +$rrdfile = $host_rrd.'/ciscowlc'.safename('.rrd'); +if (!is_file($rrdfile)) { + rrdtool_create($rrdfile, ' --step 300 DS:NUMAPS:GAUGE:600:0:12500000000 DS:NUMCLIENTS:GAUGE:600:0:12500000000 '.$config['rrd_rra']); +} + +$fields = array( + 'NUMAPS' => $numAccessPoints, + 'NUMCLIENTS' => $numClients +); +$ret = rrdtool_update($rrdfile, $fields); + +// also save the info about how many clients in the same place as the wireless module +$wificlientsrrd = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('wificlients-radio1.rrd'); + +if (!is_file($wificlientsrrd)) { + rrdtool_create($wificlientsrrd, '--step 300 DS:wificlients:GAUGE:600:-273:10000 '.$config['rrd_rra']); +} + +$fields = array( + 'wificlients' => $numClients +); + +rrdtool_update($wificlientsrrd, $fields); +$graphs['wifi_clients'] = true; From ffbde3316d754971315693549616389246adef8c Mon Sep 17 00:00:00 2001 From: Frederik Mogensen Date: Tue, 29 Sep 2015 23:50:54 +0200 Subject: [PATCH 35/40] Added Frederik to AUTHORS.md --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 6ae497f9e..6ff840e07 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -57,5 +57,6 @@ Contributors to LibreNMS: - Nils Steinger (n-st) - Mark Nagel (ciscoqid) - Sławomir Paszkiewicz (paszczus) +- Frederik Mogensen (mogensen) [1]: http://observium.org/ "Observium web site" From 335a68bb986895ab2222b54e06f4db3fc6da6a06 Mon Sep 17 00:00:00 2001 From: Daniel Preussker Date: Fri, 2 Oct 2015 00:49:18 +0000 Subject: [PATCH 36/40] Update index.php Hotfix for #2007 --- html/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/index.php b/html/index.php index 8d2503a39..e42190acc 100644 --- a/html/index.php +++ b/html/index.php @@ -32,7 +32,7 @@ function catchFatal() { } } -if (strpos($_SERVER['PATH_INFO'], "debug") || true) { +if (strpos($_SERVER['PATH_INFO'], "debug")) { $debug = "1"; ini_set('display_errors', 0); ini_set('display_startup_errors', 1); From 13d0047891168132f28b310a123b1fb693b52b23 Mon Sep 17 00:00:00 2001 From: f0o Date: Fri, 2 Oct 2015 01:43:05 +0000 Subject: [PATCH 37/40] Fix background color Fixed class definitions --- html/includes/functions.inc.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 2a1ca4dd6..df3ad76e4 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -222,7 +222,7 @@ function generate_device_link($device, $text=null, $vars=array(), $start=0, $end $url = generate_device_url($device, $vars); // beginning of overlib box contains large hostname followed by hardware & OS details - $contents = '
'.$device['hostname'].''; + $contents = '
'.$device['hostname'].''; if ($device['hardware']) { $contents .= ' - '.$device['hardware']; } @@ -248,8 +248,8 @@ function generate_device_link($device, $text=null, $vars=array(), $start=0, $end foreach ($graphs as $entry) { $graph = $entry['graph']; $graphhead = $entry['text']; - $contents .= '
'; - $contents .= ''.$graphhead.'
'; + $contents .= '
'; + $contents .= ''.$graphhead.'
'; $contents .= generate_minigraph_image($device, $start, $end, $graph); $contents .= generate_minigraph_image($device, $config['time']['week'], $end, $graph); $contents .= '
'; @@ -279,6 +279,7 @@ function generate_device_link($device, $text=null, $vars=array(), $start=0, $end function overlib_link($url, $text, $contents, $class) { global $config; + $contents = "
".$contents.'
'; $contents = str_replace('"', "\'", $contents); $output = ' Date: Fri, 2 Oct 2015 05:06:48 +0000 Subject: [PATCH 38/40] By default lock all tiles Only allow moving/resizing if in Edit mode --- html/pages/front/tiles.php | 45 ++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/html/pages/front/tiles.php b/html/pages/front/tiles.php index a3669f559..cae212029 100644 --- a/html/pages/front/tiles.php +++ b/html/pages/front/tiles.php @@ -86,9 +86,9 @@ if (!empty($shared_dashboards)) { ?>
- - - + + +
@@ -229,7 +229,10 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg }); } + var gridster_state = 0; + $(function(){ + $('[data-toggle="tooltip"]').tooltip(); dashboard_collapse(); gridster = $(".gridster ul").gridster({ widget_base_dimensions: [100, 100], @@ -260,9 +263,25 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg }).data('gridster'); gridster.remove_all_widgets(); + gridster.disable(); + gridster.disable_resize(); $.each(serialization, function() { widget_dom(this); }); + $(document).on('click','.edit-dash-btn', function() { + if (gridster_state == 0) { + gridster.enable(); + gridster.enable_resize(); + gridster_state = 1; + $('.fade-edit').fadeIn(); + } + else { + gridster.disable(); + gridster.disable_resize(); + gridster_state = 0; + $('.fade-edit').fadeOut(); + } + }); $(document).on('click','#clear_widgets', function() { var widget_id = $(this).data('widget-id'); @@ -330,7 +349,7 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg }); $(document).on("click",".edit-widget",function() { - obj = $(this).parent().parent(); + obj = $(this).parent().parent().parent(); if( obj.data('settings') == 1 ) { obj.data('settings','0'); } else { @@ -347,6 +366,12 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg $(this).fadeOut(0); }); $(target).fadeToggle(300); + if (target != "#edit_dash") { + gridster.disable(); + gridster.disable_resize(); + gridster_state = 0; + $('.fade-edit').fadeOut(); + } } else { $('.dash-collapse').fadeOut(0); } @@ -418,9 +443,12 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg function widget_dom(data) { dom = '
  • '+ - '
    '+data.title+''+ - ''+ - ''+ + '
    '+data.title+ + ''+ + ''+ + '  '+ + '  '+ + ''+ '
    '+ '
    '+data.widget+'
    '+ '\var timeout'+data.user_widget_id+' = grab_data('+data.user_widget_id+','+data.refresh+',\''+data.widget+'\');\<\/script\>'+ @@ -430,6 +458,9 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg } else { gridster.add_widget(dom, parseInt(data.size_x), parseInt(data.size_y)); } + if (gridster_state == 0) { + $('.fade-edit').fadeOut(0); + } } function widget_settings(data) { From 0321c0f1522afb44dfb3094177e2b857ba74c557 Mon Sep 17 00:00:00 2001 From: f0o Date: Fri, 2 Oct 2015 07:21:37 +0000 Subject: [PATCH 39/40] Added tooltips Fixed Placeholder message --- html/ajax_dash.php | 2 +- html/pages/front/tiles.php | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/html/ajax_dash.php b/html/ajax_dash.php index ec88e68ec..893de7a1c 100644 --- a/html/ajax_dash.php +++ b/html/ajax_dash.php @@ -28,7 +28,7 @@ if (!$_SESSION['authenticated']) { $type = mres($_POST['type']); if ($type == 'placeholder') { - $output = 'Please add a Widget to get started'; + $output = "

    Click on Edit-Dashboard to add Widgets


    Remember: You can only move & rezise widgets when you're in Edit-Mode.

    "; $status = 'ok'; $title = 'Placeholder'; } diff --git a/html/pages/front/tiles.php b/html/pages/front/tiles.php index cae212029..8d8b1f011 100644 --- a/html/pages/front/tiles.php +++ b/html/pages/front/tiles.php @@ -41,7 +41,7 @@ foreach (dbFetchRows('SELECT user_widget_id,users_widgets.widget_id,title,widget $data[] = $items; } if (empty($data)) { - $data[] = array('user_widget_id'=>'0','widget_id'=>1,'title'=>'Add a widget','widget'=>'placeholder','col'=>1,'row'=>1,'size_x'=>2,'size_y'=>2,'refresh'=>60); + $data[] = array('user_widget_id'=>'0','widget_id'=>1,'title'=>'Add a widget','widget'=>'placeholder','col'=>1,'row'=>1,'size_x'=>6,'size_y'=>2,'refresh'=>60); } $data = serialize(json_encode($data)); $dash_config = unserialize(stripslashes($data)); @@ -445,10 +445,10 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg dom = '
  • '+ '
    '+data.title+ ''+ - ''+ - '  '+ - '  '+ - ''+ + ''+ + '  '+ + '  '+ + ''+ '
    '+ '
    '+data.widget+'
    '+ '\var timeout'+data.user_widget_id+' = grab_data('+data.user_widget_id+','+data.refresh+',\''+data.widget+'\');\<\/script\>'+ @@ -461,6 +461,7 @@ foreach (dbFetchRows("SELECT * FROM `widgets` ORDER BY `widget_title`") as $widg if (gridster_state == 0) { $('.fade-edit').fadeOut(0); } + $('[data-toggle="tooltip"]').tooltip(); } function widget_settings(data) { From 2c5c5fbff987f35085ac79d25639c9bc4c823cb0 Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Fri, 2 Oct 2015 15:50:41 +0200 Subject: [PATCH 40/40] Fixed spacing to align text in menubar --- html/includes/print-menubar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 220112c51..50902dc05 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -51,7 +51,7 @@ else {