$ ./check_dns -H example.com.au -a 18.104.22.168If your host name has more than one IP address associated with it - no problem -, just add it to the command line. For example:
DNS OK: 0.157 seconds response time. example.com.au returns 22.214.171.124|time=0.157327s;;;0.000000
./check_dns -H example.com.au -a 126.96.36.199,188.8.131.52However, if your host name is using a round-robin DNS configuration you can't predict the response reliably. Try google.com.au, for instance.
DNS OK: 0.157 seconds response time. example.com.au returns 184.108.40.206,220.127.116.11|time=0.157327s;;;0.000000
$ dig google.com.au
;; ANSWER SECTION:
google.com.au. 230 IN A 18.104.22.168
google.com.au. 230 IN A 22.214.171.124
google.com.au. 230 IN A 126.96.36.199
Then check_dns will only work 1/3 of the time:
./check_dns -H google.com.au -a 188.8.131.52,184.108.40.206,220.127.116.11The other 2/3 you will see:
DNS OK: 0.035 seconds response time. google.com.au returns 18.104.22.168,22.214.171.124,126.96.36.199|time=0.035388s;;;0.000000
$ ./check_dns -H google.com.au -a 188.8.131.52,184.108.40.206,220.127.116.11I thought that really sucked because it stopped me from using this very nice feature of check_dns. So I patched check_dns.c in Nagios Plugins 1.4.10 to include the command line option "-o". When you specify this option, check_dns will sort the DNS response so you can still use -a.
DNS CRITICAL - expected '18.104.22.168,22.214.171.124,126.96.36.199' but got '188.8.131.52,184.108.40.206,220.127.116.11'
$ ./check_dns -H google.com.au -o -a 18.104.22.168,22.214.171.124,126.96.36.199I've sent the patch to the Nagios developers list - hopefully it will get incorporated into future releases. If not, you can download the patch here and the patched source here.
DNS OK: 0.112 seconds response time. google.com.au returns 188.8.131.52,184.108.40.206,220.127.116.11|time=0.111538s;;;0.000000