check_ping insists on DNS

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
erichymowitz
Posts: 10
Joined: Thu Aug 18, 2016 11:18 am

check_ping insists on DNS

Post 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?
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: check_ping insists on DNS

Post 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.
kieraculver
Posts: 1
Joined: Sun Sep 13, 2020 8:55 pm

Re: check_ping insists on DNS

Post by kieraculver »

Thanks @gormank!
Locked