Monitoring hostname.bind CH TXT DNS record

Dear Checkmk-Community

We run a cluster of DNS resolvers which announce a VIP and a less specific route via BGP using exaBGP. This means that if one of the resolvers fails and withdraws the route to its VIP, another one takes over. There is the CHAOS TXT record which tells you the hostname of the server actually responding:

dig @<resolver ip> hostname.bind TXT CHAOS

I would like to monitor whether the correct host responds to this request for a certain VIP so that we get alerted if one of the hosts withdraws its route and another one takes over.

As far as I can tell the DNS plugin only support the IN DNS class. It there an easy way to monitor the value of a CHAOS TXT record?

I’m aware that I could just modify the DNS plugins - however I’d prefer not having to maintain another fork of a plugin. So what I’m looking for is a way to monitor this without maintaining custom code.

Thanks

–b

I tried to drum up some support for handling more DNS types a while ago but it got no traction. Visibility for check_dns Ideas Portal suggestion

Why not use the classic active check - “check_dig” it is included in the folder ~/lib/nagios/plugins/.
At the moment there is only no predefined rule set available inside CMK.
You need to define the command options by yourself with the “Classic Nagios check” rule.

1 Like

Well it seemed a little odd to me that something called check_dns only handles A and PTR records and not all query types like you would expect from something called check_dns.

In addition as you said with the classic check you have to first know that such a check even exists and then configure it in WATO and there is no nice checkboxes just a bunch of fields that you have to fill out ‘blindly’. It is not a very good experience when compared to a native check and the ability to discover it is non-existent. Also at least for my version it is called “Integrate Nagios Plugins” searching for “Classic Nagios check” under the Setup tab returns no results.

check_dns is not a “native” check. It is also a classic Nagios check.

For all the classic checks it is good to have a look at Monitoring Plugins - Manpages

Simply because I didn’t know it exists. :wink: I’ll give it a try, thanks! Preliminary checks on the CLI show that it should work. I’ll follow up on this one with the exact configuration as soon as I have it working in the cli.

Supporting other types alone won’t help in my case, I also need the CHAOS rather than the INTERNET class. I checked the source code: The nagios plugin uses nslookup and doesn’t allow you to pass custom command line arguments to nslookup. On the other hand that’s exactly what you can do with the check_dig plugin. This plugin also allows you to set the type. So all that’s missing is a GUI plugin.

The nagios plugin uses nslookup and doesn’t allow you to pass custom command line arguments to nslookup. On the other hand that’s exactly what you can do with the check_dig plugin. This plugin also allows you to set the type. So all that’s missing is a GUI plugin.

Yeah you will see my proposal was actually to support using check_dig for the active check instead of check_dns. As again it seems really silly that the ‘preferred’ way inside the GUI is to use an old outdated check that doesn’t support all DNS record types doubly so when check_dig is already included as a ‘classic check’.

Here is the solution: Create a nagios rule with the following content:

image

insert the following command line:

check_dig -l "hostname.bind" -A "-c CH -t TXT" -H $_HOSTADDRESS_6$ -a <hostname>

The only caveat was that you cannot use -T TXT but have to include -t TXT within the argument for the-A flag.

Thank you @andreas-doehler, this worked like charm! The only question now: Do I mark my post or your post as the solution? (“you get credit” vs. “marking the most detailed answer as solution” :wink: )

Hi Beni!

Better option would be to mark Andreas’s post - when you mark your own it does not count in the system towards solutions provided.

And if the thread as a whole is marked as solved – I think it should not be too difficult to scroll down to see the full explanation :slight_smile:
Of course the choice is always yours.