diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index ddb7fe3667..e7af1c9dcd 100755 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -253,12 +253,12 @@ foreach ($ports as $port) // Update IF-MIB data foreach ($data_oids as $oid) { - if ($port[$oid] != $this_port[$oid] && !isset($this_port[$oid]) && $this_port['ifAdminStatus'] != 'down') + if ($port[$oid] != $this_port[$oid] && !isset($this_port[$oid])) { - $port['update'][$oid] = NULL; + $port['update'][$oid] = array('NULL'); log_event($oid . ": ".$port[$oid]." -> NULL", $device, 'interface', $port['port_id']); if ($debug) { echo($oid . ": ".$port[$oid]." -> NULL "); } else { echo($oid . " "); } - } elseif ($port[$oid] != $this_port[$oid] && $this_port['ifAdminStatus'] != 'down') { + } elseif ($port[$oid] != $this_port[$oid]) { $port['update'][$oid] = $this_port[$oid]; log_event($oid . ": ".$port[$oid]." -> " . $this_port[$oid], $device, 'interface', $port['port_id']); if ($debug) { echo($oid . ": ".$port[$oid]." -> " . $this_port[$oid]." "); } else { echo($oid . " "); } @@ -277,8 +277,15 @@ foreach ($ports as $port) $attrib_key = "port_descr_".$attrib; if ($port_ifAlias[$attrib] != $port[$attrib_key]) { + if (!isset($port_ifAlias[$attrib])) { + $port_ifAlias[$attrib] = array('NULL'); + $log_port = 'NULL'; + } else { + $log_port = $port_ifAlias[$attrib]; + } $port['update'][$attrib_key] = $port_ifAlias[$attrib]; - log_event($attrib . ": ".$port[$attrib_key]." -> " . $port_ifAlias[$attrib], $device, 'interface', $port['port_id']); + log_event($attrib . ": ".$port[$attrib_key]." -> " . $log_port, $device, 'interface', $port['port_id']); + unset($log_port); } } } diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index 3b23be7e9d..2a23caaa47 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -251,7 +251,9 @@ function rrdtool_escape($string, $maxlength = NULL) $result = str_replace('%','%%',$result); // FIXME: should maybe also probably escape these? # \ + ? [ ^ ] ( $ ) ' - + + $result = shorten_interface_type($result); + if ($maxlength != NULL) { return substr(str_pad($result, $maxlength),0,$maxlength+(strlen($result)-strlen($string))); @@ -262,4 +264,13 @@ function rrdtool_escape($string, $maxlength = NULL) } } +function shorten_interface_type($string) { + + return str_ireplace( + array('FastEthernet','GigbitEthernet','TenGigabitEthernet','Port-Channel','Ethernet'), + array('Fa','Gi','Te','Po','Eth'), + $string + ); +} + ?>