How to use dynamic IP addresses with Nagios ping check

domain-name-systemdynamic-ipnagios

I currently have problems monitoring up-time of a target machine in Nagios/Icinga that uses dynamic IP address. The network is using a Windows domain controller for DNS, Icinga server is running on a Ubuntu machine inside the network.

When running "check_ping" command manually I get the following error:

> ./check_ping -H somehost -w 10,1% -c 20,2%
check_ping: Invalid hostname/address - somehost

When I run "ping" instead it works:

> ping somehost
PING somehost.local (192.168.0.206) 56(84) bytes of data.
64 bytes from somehost.local (192.168.0.206): icmp_req=1 ttl=128 time=0.215 ms

How can I enable monitoring of hosts using dynamic IP?

Best Answer

Since your AD domain is (unfortunately) using ".local" for a DNS suffix, you probably have a conflict with mDNS (AKA zeroconf, bonjour, etc.)

Ubuntu ships with Avahi mDNS installed/enabled by default. You might have to disable (via nsswitch) or remove the avahi packages to allow non-mDNS host resolution for .local DNS names.

Also, you might want to use check_icmp instead of check_ping, as it's about 10 times faster.