From 5c26586f89ac1486f036984e9312f9963e6f8741 Mon Sep 17 00:00:00 2001 From: Rosiak Date: Thu, 4 Aug 2016 22:34:29 +0200 Subject: [PATCH 01/12] Comware Version Fix Be able to discover the version && features on older versions && newer. --- includes/polling/os/comware.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/polling/os/comware.inc.php b/includes/polling/os/comware.inc.php index c7b2195a27..556c46e31c 100644 --- a/includes/polling/os/comware.inc.php +++ b/includes/polling/os/comware.inc.php @@ -8,5 +8,6 @@ echo 'Comware OS...'; $hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:HH3C-PRODUCT-ID-MIB'); -preg_match('/Software Version (.+), Release ([a-zA-Z0-9]+)/', $poll_device['sysDescr'], $match); -list(,$version,$features) = $match; +$data = str_replace(",","",$poll_device['sysDescr']); +$version = $data['6']; +$features = $data['8']; From e19a25f4cd45c6d150ff67115a42ea0d9789efc9 Mon Sep 17 00:00:00 2001 From: Rosiak Date: Thu, 4 Aug 2016 23:11:10 +0200 Subject: [PATCH 02/12] Brain Fart --- includes/polling/os/comware.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/polling/os/comware.inc.php b/includes/polling/os/comware.inc.php index 556c46e31c..54010085ed 100644 --- a/includes/polling/os/comware.inc.php +++ b/includes/polling/os/comware.inc.php @@ -9,5 +9,6 @@ echo 'Comware OS...'; $hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:HH3C-PRODUCT-ID-MIB'); $data = str_replace(",","",$poll_device['sysDescr']); -$version = $data['6']; -$features = $data['8']; +$explodeddata = explode(" ", $data); +$version = $explodeddata['6']; +$features = $explodeddata['8']; From a2e7726cd09569cc9a08dcc40468f40f08b49d99 Mon Sep 17 00:00:00 2001 From: crcro Date: Sun, 7 Aug 2016 06:24:34 +0300 Subject: [PATCH 03/12] fixes for general apps page --- .../{dhcp-stats.inc.php => dhcp-stats_stats.inc.php} | 0 .../{os-updates.inc.php => os-updates_packages.inc.php} | 0 html/pages/apps.inc.php | 8 ++++++-- html/pages/device/apps/dhcp-stats.inc.php | 2 +- html/pages/device/apps/os-updates.inc.php | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) rename html/includes/graphs/application/{dhcp-stats.inc.php => dhcp-stats_stats.inc.php} (100%) rename html/includes/graphs/application/{os-updates.inc.php => os-updates_packages.inc.php} (100%) diff --git a/html/includes/graphs/application/dhcp-stats.inc.php b/html/includes/graphs/application/dhcp-stats_stats.inc.php similarity index 100% rename from html/includes/graphs/application/dhcp-stats.inc.php rename to html/includes/graphs/application/dhcp-stats_stats.inc.php diff --git a/html/includes/graphs/application/os-updates.inc.php b/html/includes/graphs/application/os-updates_packages.inc.php similarity index 100% rename from html/includes/graphs/application/os-updates.inc.php rename to html/includes/graphs/application/os-updates_packages.inc.php diff --git a/html/pages/apps.inc.php b/html/pages/apps.inc.php index 0a48bd432a..04c4cc21ed 100644 --- a/html/pages/apps.inc.php +++ b/html/pages/apps.inc.php @@ -76,8 +76,12 @@ $graphs['nfs-v3-stats'] = array( 'rpc', ); -$graphs['os-updates'] = array(''); -$graphs['dhcp-stats'] = array(''); +$graphs['os-updates'] = array( + 'packages', +); +$graphs['dhcp-stats'] = array( + 'stats', +); print_optionbar_start(); diff --git a/html/pages/device/apps/dhcp-stats.inc.php b/html/pages/device/apps/dhcp-stats.inc.php index debe352ffc..707d55c95a 100644 --- a/html/pages/device/apps/dhcp-stats.inc.php +++ b/html/pages/device/apps/dhcp-stats.inc.php @@ -3,7 +3,7 @@ global $config; $graphs = array( - 'dhcp-stats' => 'DHCP Stats', + 'dhcp-stats_stats' => 'DHCP Stats', ); foreach ($graphs as $key => $text) { diff --git a/html/pages/device/apps/os-updates.inc.php b/html/pages/device/apps/os-updates.inc.php index 31ba45b92a..772dc85d1e 100644 --- a/html/pages/device/apps/os-updates.inc.php +++ b/html/pages/device/apps/os-updates.inc.php @@ -3,7 +3,7 @@ global $config; $graphs = array( - 'os-updates' => 'OS updates', + 'os-updates_packages' => 'OS updates', ); foreach ($graphs as $key => $text) { From 330910b4e39ebe20fd3f363f4417d9b2a5ac7f9d Mon Sep 17 00:00:00 2001 From: vitalisator Date: Sun, 7 Aug 2016 17:47:25 +0200 Subject: [PATCH 04/12] Fix a bug in syslog since PR #3812 syslog writes to wrong device id in syslog table. this happens on all devices where inet_pton() returns false. --- includes/syslog.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/syslog.php b/includes/syslog.php index ab4d1e2a12..fa0eacacae 100644 --- a/includes/syslog.php +++ b/includes/syslog.php @@ -13,7 +13,12 @@ function get_cache($host, $value) { case 'device_id': // Try by hostname $ip = inet_pton($host); - $dev_cache[$host]['device_id'] = dbFetchCell('SELECT `device_id` FROM devices WHERE `hostname` = ? OR `sysName` = ? OR `ip` = ?', array($host, $host, $ip)); + if (var_export(inet_ntop($ip),1) == 'false') { + $dev_cache[$host]['device_id'] = dbFetchCell('SELECT `device_id` FROM devices WHERE `hostname` = ? OR `sysName` = ?', array($host, $host)); + } + else { + $dev_cache[$host]['device_id'] = dbFetchCell('SELECT `device_id` FROM devices WHERE `hostname` = ? OR `sysName` = ? OR `ip` = ?', array($host, $host, $ip)); + } // If failed, try by IP if (!is_numeric($dev_cache[$host]['device_id'])) { $dev_cache[$host]['device_id'] = dbFetchCell('SELECT `device_id` FROM `ipv4_addresses` AS A, `ports` AS I WHERE A.ipv4_address = ? AND I.port_id = A.port_id', array($host)); From d65364c8efab5d387b521245a9106efec0bf3329 Mon Sep 17 00:00:00 2001 From: Rosiak Date: Sun, 7 Aug 2016 23:40:12 +0200 Subject: [PATCH 05/12] Fix Dell PowerConnect Discovery #3995 --- includes/discovery/os/radlan.inc.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/includes/discovery/os/radlan.inc.php b/includes/discovery/os/radlan.inc.php index da34ae5223..1474289736 100644 --- a/includes/discovery/os/radlan.inc.php +++ b/includes/discovery/os/radlan.inc.php @@ -1,10 +1,6 @@ Date: Mon, 8 Aug 2016 17:36:19 +0200 Subject: [PATCH 06/12] reduction, thx an @murrant --- includes/syslog.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/syslog.php b/includes/syslog.php index fa0eacacae..26b7ba7901 100644 --- a/includes/syslog.php +++ b/includes/syslog.php @@ -13,7 +13,7 @@ function get_cache($host, $value) { case 'device_id': // Try by hostname $ip = inet_pton($host); - if (var_export(inet_ntop($ip),1) == 'false') { + if (inet_ntop($ip) === false) { $dev_cache[$host]['device_id'] = dbFetchCell('SELECT `device_id` FROM devices WHERE `hostname` = ? OR `sysName` = ?', array($host, $host)); } else { From 057d78aab792b49a1a7743c82059d4c97f43ad60 Mon Sep 17 00:00:00 2001 From: Rosiak Date: Mon, 8 Aug 2016 18:34:30 +0200 Subject: [PATCH 07/12] Remove more code --- includes/polling/os/radlan.inc.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/includes/polling/os/radlan.inc.php b/includes/polling/os/radlan.inc.php index aa0da3818a..2935cc92df 100644 --- a/includes/polling/os/radlan.inc.php +++ b/includes/polling/os/radlan.inc.php @@ -1,16 +1,8 @@ Date: Mon, 8 Aug 2016 19:53:04 +0100 Subject: [PATCH 08/12] Added php lint checking for travis --- .travis.yml | 26 +++++++++++++-------- html/includes/graphs/port/pagp_bits.inc.php | 2 +- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 36f9fbddea..16a2eb9a55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,19 @@ language: php - -php: - - '5.3' - - '5.4' - - '5.5' - - '5.6' - - '7.0' - - hhvm - matrix: + fast_finish: true + include: + - php: 5.3 + script: find . -path './lib/influxdb-php' -prune -o -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 + - php: 5.4 + script: find . -path './lib/influxdb-php' -prune -o -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 + - php: 5.5 + script: find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 + - php: 5.6 + script: find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 + - php: 7.0 + script: find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 + - php: hhvm + script: find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 allow_failures: - - php: 7.0 + - php: 7.0 + - php: hhvm diff --git a/html/includes/graphs/port/pagp_bits.inc.php b/html/includes/graphs/port/pagp_bits.inc.php index 7cce013217..450edde0f9 100644 --- a/html/includes/graphs/port/pagp_bits.inc.php +++ b/html/includes/graphs/port/pagp_bits.inc.php @@ -3,7 +3,7 @@ // Generate a list of ports and then call the multi_bits grapher to generate from the list $i = 0; foreach (dbFetchRows('SELECT * FROM `ports` WHERE `device_id` = ? AND `pagpGroupIfIndex` = ?', array($port['device_id'], $port['ifIndex'])) as $int) { - $rrd_file = get_port_rrdfile_path ($hostname, int['port_id']); + $rrd_file = get_port_rrdfile_path ($hostname, $int['port_id']); if (is_file($rrd_file)) { $rrd_list[$i]['filename'] = $rrd_file; $rrd_list[$i]['descr'] = $int['ifDescr']; From 544fd95a635d3166f572145bbc4de9df4cf7d4f5 Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 8 Aug 2016 20:03:40 +0100 Subject: [PATCH 09/12] Updated to support php 5.3 --- includes/polling/applications/proxmox.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/polling/applications/proxmox.inc.php b/includes/polling/applications/proxmox.inc.php index c1e366b362..c86a6e5a92 100644 --- a/includes/polling/applications/proxmox.inc.php +++ b/includes/polling/applications/proxmox.inc.php @@ -51,7 +51,7 @@ if (!is_dir($pmxcdir)) { dbUpdate(array('device_id' => $device['device_id'], 'app_type' => 'proxmox', 'app_instance' => $pmxcluster), 'applications', '`device_id` = ? AND `app_type` = ?', array($device['device_id'], 'proxmox')); if (count($pmxlines) > 0) { - $pmxcache = []; + $pmxcache = array(); foreach ($pmxlines as $vm) { list($vmid, $vmport, $vmpin, $vmpout, $vmdesc) = explode('/', $vm, 5); From bcd2476f321295256e80e5dd67248491c9918ac1 Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 8 Aug 2016 20:13:33 +0100 Subject: [PATCH 10/12] Updated travis + added build icons --- .travis.yml | 2 +- README.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 16a2eb9a55..a3ea97cf9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ matrix: - php: 7.0 script: find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 - php: hhvm - script: find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 + script: find . -path './lib/influxdb-php' -prune -o -name "*.php" -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected' ; test $? -eq 1 allow_failures: - php: 7.0 - php: hhvm diff --git a/README.md b/README.md index 2d3555809b..926658660a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://scrutinizer-ci.com/g/librenms/librenms/badges/build.png?b=master)](https://scrutinizer-ci.com/g/librenms/librenms/build-status/master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/librenms/librenms/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/librenms/librenms/?branch=master) [![Build Status](https://travis-ci.org/librenms/librenms.svg?branch=master)](https://travis-ci.org/librenms/librenms) + Introduction ------------ From 34feda861370ec961c7161303d70bf85aea55d4c Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 8 Aug 2016 20:20:18 +0100 Subject: [PATCH 11/12] Fixed ./includes/polling/applications/rrdcached.inc.php for php 53 --- includes/polling/applications/rrdcached.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/polling/applications/rrdcached.inc.php b/includes/polling/applications/rrdcached.inc.php index 21bb5e4684..f37136402b 100644 --- a/includes/polling/applications/rrdcached.inc.php +++ b/includes/polling/applications/rrdcached.inc.php @@ -53,7 +53,8 @@ if ($agent_data['app']['rrdcached']) { while ($max == -1 || $count < $max) { $data .= fgets($sock, 128); if ($max == -1) { - $max = explode(' ', $data)[0] + 1; + $tmp_max = explode(' ', $data); + $max = $tmp_max[0]+1; } $count++; } From 09eb5ca1e94d4c9e970b174f817225331f6199c9 Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 8 Aug 2016 20:26:44 +0100 Subject: [PATCH 12/12] Fixed ./includes/polling/os/infinity.inc.php for php 53 --- includes/polling/os/infinity.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/polling/os/infinity.inc.php b/includes/polling/os/infinity.inc.php index bf4d70981c..61c11edec7 100644 --- a/includes/polling/os/infinity.inc.php +++ b/includes/polling/os/infinity.inc.php @@ -10,6 +10,6 @@ * the source code distribution for details. */ -$version = $poll_device['sysDescr']; -$version = explode(' ', $version)[2]; +$version = explode(' ', $poll_device['sysDescr']); +$version = $version[2]; $hardware = snmp_get($device, 'IEEE802dot11-MIB::dot11manufacturerProductName.5', '-Ovq');