Nagios - check_dns

 

 


check_dns

 

Usage:

check_dns -H host [-s server]

-H, --hostname=HOST                 # The name or address you want to query

-s, --server=HOST                       # Optional DNS server you want to use for the lookup

# If no DNS server is specified, the default server(s) specified in /etc/resolv.conf will be used.

command:

i.e. check_dns

define command{
        command_name    check_dns
        command_line    $USER1$/check_dns -H hk.yahoo.com -s $HOSTADDRESS$
        }

i.e. check_dns_itself

define command{
        command_name    check_dns_itself
        command_line    $USER1$/check_dns -H $HOSTNAME$ -s $HOSTADDRESS$
        }

service:

define service{
        name                            service-dns
        use                             local-service
        service_description             DNS
        check_command                   check_dns
        register                        0
}

Troubleshoot

CRITICAL - Plugin timed out while executing system call

出事的一句

commands.cfg:

command_line    $USER1$/check_dns -H hk.yahoo.com -s $HOSTADDRESS$

Other Opts

-q, --querytype=TYPE    # A(default), AAAA, SRV, TXT, MX, ANY

-a, --expected-address=IP-ADDRESS|HOST

This option can be repeated multiple times (Returns OK if any value match).

If multiple addresses are returned at once, you have to match
    the whole string of addresses separated with commas (sorted alphabetically).

-n, --accept-cname

Optionally accept cname responses as a valid result to a query

The default is to ignore cname responses as part of the result