diff --git a/includes/services.inc.php b/includes/services.inc.php index ddfaf638382b..d6a019cb4ae5 100644 --- a/includes/services.inc.php +++ b/includes/services.inc.php @@ -5,6 +5,7 @@ use LibreNMS\Config; use LibreNMS\RRD\RrdDefinition; use LibreNMS\Util\Clean; +use LibreNMS\Util\IP; function get_service_status($device = null) { @@ -122,9 +123,9 @@ function poll_service($service) $update = []; $old_status = $service['service_status']; $service['service_type'] = Clean::fileName($service['service_type']); - $service['service_ip'] = Clean::fileName($service['service_ip']); - $service['hostname'] = Clean::fileName($service['hostname']); - $service['overwrite_ip'] = Clean::fileName($service['overwrite_ip']); + $service['service_ip'] = IP::isValid($service['service_ip']) ? $service['service_ip'] : Clean::fileName($service['service_ip']); + $service['hostname'] = IP::isValid($service['hostname']) ? $service['hostname'] : Clean::fileName($service['hostname']); + $service['overwrite_ip'] = IP::isValid($service['overwrite_ip']) ? $service['overwrite_ip'] : Clean::fileName($service['overwrite_ip']); $check_cmd = ''; // if we have a script for this check, use it.