From 6fbd8b3f05cbef2d13962ed9b1eff516f3a4ec53 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Thu, 22 Sep 2016 11:39:15 -0500 Subject: [PATCH] fix: port ifLastChange polling (#4541) * fix: port ifLastChange polling * Small changes, default to 0 * Don't update 0->0 --- includes/polling/ports.inc.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index 907faa16ad..79c0adcc1c 100644 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -7,7 +7,6 @@ $data_oids = array( 'ifAlias', 'ifAdminStatus', 'ifOperStatus', - 'ifLastChange', 'ifMtu', 'ifSpeed', 'ifHighSpeed', @@ -131,11 +130,11 @@ if (!in_array($device['hardware'], $config['os'][$device['os']]['bad_ifXEntry']) $hc_test = array_slice($port_stats, 0, 1); if (!isset($hc_test[0]['ifHCInOctets']) && !is_numeric($hc_test[0]['ifHCInOctets'])) { - $port_stats = snmpwalk_cache_oid($device, 'ifEntry', $port_stats, 'IF-MIB'); + $port_stats = snmpwalk_cache_oid($device, 'ifEntry', $port_stats, 'IF-MIB', null, '-OQUst'); } else { foreach ($ifmib_oids as $oid) { echo "$oid "; - $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, 'IF-MIB'); + $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, 'IF-MIB', null, '-OQUst'); } } @@ -424,6 +423,13 @@ foreach ($ports as $port) { $this_port['ifDuplex'] = $this_port['dot3StatsDuplexStatus']; } + // update ifLastChange. only in the db, not rrd + if (isset($this_port['ifLastChange']) && is_numeric($this_port['ifLastChange'])) { + $port['update']['ifLastChange'] = $this_port['ifLastChange']; + } elseif ($port['ifLastChange'] != 0) { + $port['update']['ifLastChange'] = 0; // no data, so use the same as device uptime + } + // Set VLAN and Trunk from Cisco if (isset($this_port['vlanTrunkPortEncapsulationOperType']) && $this_port['vlanTrunkPortEncapsulationOperType'] != 'notApplicable') { $this_port['ifTrunk'] = $this_port['vlanTrunkPortEncapsulationOperType'];