[Nagiosplug-devel] Patch to check_ntp_time.c and netutils.c to not resolve hostname if given as an IP address
fra.nospam.nk at gmx.de
Mon Dec 24 15:02:24 CET 2012
i'd like to propose the attached patch against the current nagios-plugins-1.4.16
sources. Although it's a bit hacky, i tried to accomplish the following with this
- Add help output wrt the "-4" and "-6" command line options.
- Move "is_host()" check to after the evaluation of the "-4" and "-6" command
line options. Otherwise, when built with "USE_IPV6", the address_family for
the call to resolve_host_or_addr stays at the default AF_UNSPEC instead of
being set to AF_INET or AF_INET6.
- Add check logic to determine if the argument passed to the "-H" command line
option is already a valid IPv4 or IPv6 address. In this case no name lookup
with getaddrinfo should be necessary.
I recently ran into an issue related to this: The check_ntp_time calls were
configured against the IP adresses of two NTP servers, e.g.:
check_ntp_time -H 192.168.1.1 -w ... -c ...
check_ntp_time -H 192.168.2.1 -w ... -c ...
The IP addresses were deliberately used to be independent of DNS glitches.
Still, when the companies DNS/AD went half braindead, check_ntp_time started
complaining about NTP connection issues, steering everyone a bit in the wrong
direction. In this particular case it was a good thing, because it would've
been a much longer time before someone would've figured out a only partially
working DNS/AD ;-)
See here for an explaination of the "ifdef _AIX":
Any comments are very welcome!
Thanks & best regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1766 bytes
Desc: not available
More information about the Devel