Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_dns_host
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$
}
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.
#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.
bysteprog, November 28, 2013
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?
"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)
if (defined $match)
replaced by:
if (defined @match)