fix: show sysName on network map when ip_to_sysname enabled (#5962)

This commit is contained in:
towster
2017-02-21 02:04:18 -06:00
committed by Neil Lathwood
parent 847587244f
commit acbdda94b8

View File

@ -51,9 +51,11 @@ if (in_array('mac', $config['network_map_items'])) {
`D1`.`device_id` AS `local_device_id`,
`D1`.`os` AS `local_os`,
`D1`.`hostname` AS `local_hostname`,
`D1`.`sysName` AS `local_sysName`,
`D2`.`device_id` AS `remote_device_id`,
`D2`.`os` AS `remote_os`,
`D2`.`hostname` AS `remote_hostname`,
`D2`.`sysName` AS `remote_sysName`,
`P1`.`port_id` AS `local_port_id`,
`P1`.`device_id` AS `local_port_device_id`,
`P1`.`ifName` AS `local_ifname`,
@ -94,9 +96,11 @@ if (in_array('xdp', $config['network_map_items'])) {
`D1`.`device_id` AS `local_device_id`,
`D1`.`os` AS `local_os`,
`D1`.`hostname` AS `local_hostname`,
`D1`.`sysName` AS `local_sysName`,
`D2`.`device_id` AS `remote_device_id`,
`D2`.`os` AS `remote_os`,
`D2`.`hostname` AS `remote_hostname`,
`D2`.`sysName` AS `remote_sysName`,
`P1`.`port_id` AS `local_port_id`,
`P1`.`device_id` AS `local_port_device_id`,
`P1`.`ifName` AS `local_ifname`,
@ -143,12 +147,14 @@ foreach ($list as $items) {
$local_device_id = $items['local_device_id'];
if (!array_key_exists($local_device_id, $devices_by_id)) {
$devices_by_id[$local_device_id] = array('id'=>$local_device_id,'label'=>$items['local_hostname'],'title'=>generate_device_link($local_device, '', array(), '', '', '', 0),'shape'=>'box');
$items['sysName'] = $items['local_sysName'];
$devices_by_id[$local_device_id] = array('id'=>$local_device_id,'label'=>shorthost(ip_to_sysname($items, $items['local_hostname']), 1),'title'=>generate_device_link($local_device, '', array(), '', '', '', 0),'shape'=>'box');
}
$remote_device_id = $items['remote_device_id'];
if (!array_key_exists($remote_device_id, $devices_by_id)) {
$devices_by_id[$remote_device_id] = array('id'=>$remote_device_id,'label'=>$items['remote_hostname'],'title'=>generate_device_link($remote_device, '', array(), '', '', '', 0),'shape'=>'box');
$items['sysName'] = $items['remote_sysName'];
$devices_by_id[$remote_device_id] = array('id'=>$remote_device_id,'label'=>shorthost(ip_to_sysname($items, $items['remote_hostname']), 1),'title'=>generate_device_link($remote_device, '', array(), '', '', '', 0),'shape'=>'box');
}
$speed = $items['local_ifspeed']/1000/1000;