Added config option to force showing sysName instead of IP

This commit is contained in:
laf
2016-01-17 22:01:09 +00:00
parent e380cc5100
commit 5e37de8b65
3 changed files with 19 additions and 0 deletions

View File

@@ -209,6 +209,8 @@ function generate_device_link($device, $text=null, $vars=array(), $start=0, $end
$text = $device['hostname'];
}
$text = ip_to_sysname($device,$text);
if (isset($config['os'][$device['os']]['over'])) {
$graphs = $config['os'][$device['os']]['over'];
}

View File

@@ -1040,3 +1040,19 @@ function version_info($remote=true) {
return $output;
}//end version_info()
/**
* Convert IP to use sysName
* @param array device
* @param string ip address
* @return string
**/
function ip_to_sysname($device,$ip) {
global $config;
if ($config['force_ip_to_sysname'] === true) {
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) == true || filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) == true) {
$ip = $device['sysName'];
}
}
return $ip;
}//end ip_to_sysname

View File

@@ -779,6 +779,7 @@ $config['dateformat']['mysql']['time'] = '%H:%i:%s';
$config['enable_clear_discovery'] = 1;
// Set this to 0 if you want to disable the web option to rediscover devices
$config['force_ip_to_sysname'] = false;// Set to true if you want to use sysName in place of IPs
$config['enable_port_relationship'] = true;
// Set this to false to not display neighbour relationships for ports
$config['enable_footer'] = 1;