Skip hostnames which are blank when generating the smokeping config (#15144)

This commit is contained in:
Neil Lathwood
2023-07-14 22:50:37 +01:00
committed by GitHub
parent 0eebe7a255
commit 798ad4dc57

View File

@@ -338,6 +338,9 @@ class SmokepingGenerateCommand extends LnmsCommand
*/
private function deviceIsResolvable($hostname)
{
if (empty($hostname)) {
return false;
}
// First we check for IP literals, then for a dns entry, finally for a hosts entry due to a PHP/libc limitation
// We look for the hosts entry last (and separately) as this only works for v4 - v6 host entries won't be found
if (filter_var($hostname, FILTER_VALIDATE_IP) || checkdnsrr($hostname, 'ANY') || is_array(gethostbynamel($hostname))) {