Merge branch 'master' of git://github.com/librenms/librenms

This commit is contained in:
Paul Gear
2015-03-28 16:17:41 +10:00
2 changed files with 23 additions and 5 deletions

View File

@@ -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);
}
}
}

View File

@@ -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
);
}
?>