Page 1 of 1

Weird behavior check_dns

Posted: Mon Jan 04, 2021 2:16 pm
by RyanMule
Hello All,

Just recently upgraded to 5.7.5 XI from 5.6.14 and it appears to have broken my check_dns service check.
This is the command I have been using:

$USER1$/check_dns -H $HOSTADDRESS$ $ARG1$

The error I get below when using an IP
[nagios@nagios02 ~]$ /usr/local/nagios/libexec/check_dns -H 192.168.11.88
DNS CRITICAL - query type of -querytype=A was not found for 192.168.11.88

The error I get below when using hostname
[nagios@nagios02 ~]$ /usr/local/nagios/libexec/check_dns -H prodmgt01
DNS OK: 0.015 seconds response time. prodmgt01 returns 192.168.11.88|time=0.015023s;;;0.000000

How do I force it to check hostname and not IP?

Thank you
Ryan

Re: Weird behavior check_dns

Posted: Tue Jan 05, 2021 2:30 pm
by cdienger
By default the check_dns plugin will try to resolve a hostname to an IP address. This info is stored in an 'A' record so the message you're seeing is correct.

To resolve an IP to a hostname you need the PTR record. You can make check_dns look for this record with the -q option:

Code: Select all

/usr/local/nagios/libexec/check_dns -H 192.168.11.88 -q

Re: Weird behavior check_dns

Posted: Tue Jan 05, 2021 2:56 pm
by RyanMule
That did the trick! added "-q PTR"

Thank you!

Re: Weird behavior check_dns

Posted: Wed Jan 06, 2021 10:26 am
by cdienger
Glad to hear!