Page 1 of 1

check_ping insists on DNS

Posted: Tue Sep 08, 2020 9:49 am
by erichymowitz
So I'm not sure if this is a bug, or by design... and I don't know enough about system internals to know whose bug/feature it is.

I'm running this command:

/usr/lib64/nagios/plugins/check_ping -H nessus-lab -w 100,20% -c 500,60%

strace tells me that it's following this path:
  • Read /etc/nsswitch.conf, which says "hosts: files dns"
  • Read /etc/host.conf, which doesn't exist
  • Read /etc/resolv.conf
  • Read the /etc/hosts file
  • Attempt to nslookup the hostname against every server in /etc/resolv.conf using every "search" domain in /etc/resolv.conf
So I don't understand why it's going to /etc/resolv.conf first, instead of looking at the /etc/hosts file first (like /etc/nsswitch.conf says) .

(This is a problem because one of my DNS servers is acting flaky ... and I know that's my problem ... but it shouldn't matter.)

Can somebody enlighten me?

Re: check_ping insists on DNS

Posted: Tue Sep 08, 2020 1:10 pm
by gormank
I don't think this related to Nagios or the plugin. If you use a hostname, there are system calls that try to resolve the address. If you want to use the address, you can change the service to use the address, not the hostname.

Re: check_ping insists on DNS

Posted: Sun Sep 13, 2020 8:58 pm
by kieraculver
Thanks @gormank!