(18 July 2012)
Sample Installation of check_dnsext
check_dnsext is availble here:
http://exchange.nagios.org/directory/Plugins/Internet-Domains-and-WHOIS/check_dnsext/detailsThe author comments that Array::Compare isn't available through yum, but he's wrong. EL5 users can get it through rpmforge. In my case it required installing 14 other RPMs at the same time.
In my specific case, I want to check on the existence of SRV records for exchange autodiscover, because one of the hosting packages I use doesn't have native support for these records, and if the manually changed zone file gets re-written by the auto-writer then the SRV record disappears and needs to be manually re-created.
So here's how I did it:
/etc/objects/commands.cfg:
define command{
command_name check_dnsext
command_line /usr/lib/nagios/plugins/check_dnsext -H $ARG2$ -s $HOSTADDRESS$ -t SRV -a $ARG3$
}
/etc/nagios/objects/macros.m4:
define(`DODNSSRVCHECK',`define service{
use generic-service
service_description ZONE-SRV-$2
host_name $1
check_period workhours
normal_check_interval 20
retry_check_interval 20
notification_interval 10080
check_command check_dnsext!$1!$2!$3
} ')dnl
This has a sample invocation in the customer .m4 file as so (pre-supposing that the server gw-ns1 has already been defined):
DODNSSRVCHECK(`gw-ns1',`_autodiscover._tcp.gridway.net',`autodiscover.mygridway.net')
...which expands in the actual .cfg file to be:
define service{
use generic-service
service_description ZONE-SRV-_autodiscover._tcp.gridway.net
host_name gw-ns1
check_period workhours
normal_check_interval 20
retry_check_interval 20
notification_interval 10080
check_command check_dnsext!gw-ns1!_autodiscover._tcp.gridway.net!autodiscover.mygridway.net
}