Nagios DNS check gets wrong parameters

Hi, I installed nagios plugins and I’m trying to implement DNS check. From the command line

./check_dns -H -s -a GOOD_IP_1 -a GOOD_IP_2 -c 2

gets me the correct result
DNS OK: 0.020 seconds response time. returns GOOD_IP_1|time=0.019513s;;2.000000;0.000000

Now I’m creating the service linked to the DNS server, so I put:
IP Address: the part that usually gets the -H parameter:
Parameters: -s -a GOOD_IP_1 -a GOOD_IP_2

From the debug I get:

Request: ‘/usr/lib/nagios/plugins/check_dns’ ‘-H’ ‘-H’ ‘’ ‘-s’ ‘’ ‘-a’ ‘GOOD_IP_1’ ‘-a’ ‘GOOD_IP_2’ ‘-s’ ‘’
Perf Data - None.

I tried any othe combination in the box (swapped -s and -H, put -H as ‘’), but always I get the second “-s” that is not in my parameters, and a double “-H” one of which is empty.
Which should be the correct IP/Parameters setting for my configuration?
Eventually I created a custom script that invokes the right command, but it is pretty weird.

-H always takes the hostname in LibreNMS - it cannot be changed. Use check_dig instead…

I tried, but check_dig seems to accept a single “-a” argument to check the result. If I put several ones (and I need to check several possible replies) I always get a WARNING

It works for me with multiple -a arguments.

/usr/lib/nagios/plugins/check_dig -H nameserver -l query -a answer -a answer2…

It works in the sense that it does not spit an error, but the result is always:

DNS WARNING - 0.009 seconds response time (Server not found in ANSWER SECTION)|time=0.009258s;;;0.000000

and if you run the command with -v you’ll find the it always check for the LAST -a you put. You can see the first line of the debug output
Looking for: ''.
Each -a overrides the preceding, it is semantically different form -a in check_dns

ah OK - I don’t actually have that usecase. I’m really just checking that the nameservers are working/

OK, that topic is old, but there’s a solution now. As this was the only post I found on this topic I reply here:

There’s an include for check_dns now:

I had the same issue.
./check-services.php -d showed me something weird…

Now with the resolver address in the “Remote Host” field and the address to query in the “Parameters” field it works for me.


Does this DNS check only work with Linux servers or should it work with any DNS server?
I have this enabled for a Windows server running DNS but I just get ‘Error Drawing Graph’ for NTP Client and NTP Server.

Kind regards

well… this is about check_dns … and I’m actually running this service-check against a windows DNS server …

If you actually want to monitor some NTP service … maybe you describe your problem in a new post?