I use Nagios (actually Icinga) at work and do a lot of tinkering with it. I recently needed to modify the check_dig command to allow for verifying whether a response is authoritative or not. This is apparently something that’s asked for a lot according to some Google searching that I’ve done, so I wrote a quick patch, and I’ve submitted it to the Nagios Plugin project on Sourceforge. Hopefully they’ll accept it, but in the meantime I thought I’d post it here as well so others can make use of it if the have a need for it.
The patch is available two ways depending on your preference. You can just download a patched version of nagios-plugins-1.4.15.tar.gz, build the plugins as you normally would, and be on your way. Or you can download the official version of nagios-plugins-1.4.15.tar.gz from Sourceforge and just apply this check_dig patch. To apply the patch:
[brucep@carbon:~/tmp] tar xvzf nagios-plugins-1.4.15.tar.gz
[brucep@carbon:~/tmp] gunzip check_dig.patch.gz
[brucep@carbon:~/tmp] patch -p0 < check_dig.patch # Note, that’s a zero, not the letter o.
Assuming the patch command doesn’t report any problems you should be all set. Just rebuild the plugins and you’re good to go. This adds a ‘-e’ option to the command line. If you use -e then check_dig will verify that the flags header from dig contains the ‘aa’ flag. If the ‘aa’ flag isn’t found then check_dig will return a CRITICAL error.
If you’d like to keep track of the status of the patch on Sourceforge you can check it here.