mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge pull request #676 from laf/issue-657
Shorten interface names into Fa, Gi, Te
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user