Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

check_dns_host

Rating
4 votes
Favoured:
0
Hits
102965
Files:
FileDescription
check_dns_host.plInitial public release, 1.0
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Check A/PTR records for a host. Support for checking returnval vs. an array for matching valid response(s), threshhold for number of returned responses, and timeout values.
Perl, uses (requires):

Net::DNS
Getopt::Long
Array::Compare
Pod::Usage
Time::HiRes

/ Example service definition:

define service{

use generic-service
hostgroup_name deathstar*
servicegroups dns_alerts
service_description DNS_forward
check_command check_dns_host_forward_match!1
notification_options c
}


define service{

use generic-service
hostgroup_name deathstar*
servicegroups dns_alerts
service_description DNS_reverse
check_command check_dns_host_reverse_match!1
notification_options c
}


/ Example command definition:

define command{

command_name check_dns_host_forward_match
command_line $USER1$/check_dns_host.pl -H $HOSTALIAS$ -q FORWARD -w 50 -c 500 -m $HOSTADDRESS$ -r $ARG1$
}


define command{

command_name check_dns_host_reverse_match
command_line $USER1$/check_dns_host.pl -H $HOSTADDRESS$ -q REVERSE -w 50 -c 500 -m $HOSTALIAS$ -r $ARG1$
}

Reviews (3)
byTozz, May 29, 2014
Checking for reverse doesn't work, eg.:

#check_dns_host.pl -H 8.8.8.8.in-addr.arpa -Q REVERSE -W 1000 -C 1000

DNS OK! QUERYRETURNCODE=(NOERROR => 8.8.8.8.in-addr.arpa) ANSWERS=(0) QUERY_RETURNVAL=() ELAPSED=(8 ms) | DurationMS=8

Reverse checks always return ANSWERS=(0).

Forward seems to work fine.
from the commnd line runs without error ONLY if I change the line in the sub query_check like
"if (defined ($match)) {"
But Nagios always report the error "(Service check did not exit properly) "
Any suggestion?
byrmarx, May 9, 2013
On sub query_check, match verification:

if (defined $match)

replaced by:
if (defined @match)