mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added config option to force showing sysName instead of IP
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user