mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge pull request #752 from laf/issue-743
Shorten interface names on map
This commit is contained in:
@@ -737,4 +737,13 @@ function get_client_ip() {
|
|||||||
return $client_ip;
|
return $client_ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shorten_interface_type($string) {
|
||||||
|
|
||||||
|
return str_ireplace(
|
||||||
|
array('FastEthernet','GigbitEthernet','TenGigabitEthernet','Port-Channel','Ethernet'),
|
||||||
|
array('Fa','Gi','Te','Po','Eth'),
|
||||||
|
$string
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -46,11 +46,11 @@ if (is_array($tmp_devices[0])) {
|
|||||||
foreach ($tmp_devices as $k=>$v) {
|
foreach ($tmp_devices as $k=>$v) {
|
||||||
if ($v['id'] == $link_devices['local_device_id']) {
|
if ($v['id'] == $link_devices['local_device_id']) {
|
||||||
$from = $v['id'];
|
$from = $v['id'];
|
||||||
$port = $link_devices['local_port'];
|
$port = shorten_interface_type($link_devices['local_port']);
|
||||||
}
|
}
|
||||||
if ($v['id'] == $link_devices['remote_device_id']) {
|
if ($v['id'] == $link_devices['remote_device_id']) {
|
||||||
$to = $v['id'];
|
$to = $v['id'];
|
||||||
$port .= ' > ' .$link_devices['remote_port'];
|
$port .= ' > ' .shorten_interface_type($link_devices['remote_port']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$speed = $link_devices['ifSpeed']/1000/1000;
|
$speed = $link_devices['ifSpeed']/1000/1000;
|
||||||
|
@@ -264,13 +264,4 @@ 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