mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: port ifLastChange polling (#4541)
* fix: port ifLastChange polling * Small changes, default to 0 * Don't update 0->0
This commit is contained in:
@@ -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'];
|
||||
|
||||
Reference in New Issue
Block a user