[Nagiosplug-devel] RFC: gethostbyname instead of getaddrinfo
Ton Voon
ton.voon at opsera.com
Tue Feb 10 14:38:28 CET 2009
Hi!
Found an issue at a customer site which I think requires a change in
the plugins which might impact on a lot of things.
Customer setup is this:
- host checks use check_icmp, host address is the DNS name
- service checks use a mixture of plugins, including check_tcp
Customer had a primary DNS failure. A lot of service alerts raised.
Analysis showed that the host checks were all considered OK and the
service checks were "(Service Check timed out)". However, check_nrpe
service checks worked correctly.
I think this is due to the plugins using getaddrinfo (which is a DNS
call), rather than using gethostbyname (which is an OS call). In this
DNS setup, the OS must be caching the DNS results, hence check_icmp
and check_nrpe working correctly. As check_tcp is using a different
method, its results are inconsistent with the host results.
I propose changing all instances of getaddrinfo to gethostbyname in
the plugins. This will have an added benefit of reducing the load on
DNS servers.
I guess some plugins may specifically want to use getaddrinfo (say a
DNS round robin web server), but I think those are the exceptions to
the rule.
Since gethostbyname is already used by check_nrpe and check_icmp, I've
confident of the availability of this function.
Comments?
Ton
More information about the Devel
mailing list