check_dns

Runs check_dns to check nameservers. It wraps the plugin from https://github.com/mackerelio/go-check-plugins/tree/master/check-dns

Implementation

WindowsLinuxFreeBSDmacOS
✅✅✅✅

Usage

  check_dns [OPTIONS]

Application Options:
  -H, --host=             Name or address to query
  -s, --server=           DNS servers for the lookup. Repeat this option to specify multiple servers.
  -p, --port=             Port number to use (default: 53)
  -q, --querytype=        DNS record query type (default: A)
      --norec             Clear the Recursion Desired flag. The DNS server answers only from authoritative data or its
                          cache, without querying other nameservers.
  -e, --expected-string=  IP-ADDRESS string to expect from the DNS server. If the server returns multiple IP addresses
                          at once, specify the entire string
      --search-path=      Search paths to add to domains before a DNS query. Repeat this option to specify multiple
                          paths.
      --resolv-conf-file= Path to the resolv.conf file. Not used on Windows. (default: /etc/resolv.conf)
  -v, --verbose           Show verbose output.
  -w, --warning=          If a successful DNS query takes longer than this value in seconds, return warning. Disabled
                          by default.
  -c, --critical=         If a successful DNS query takes longer than this value in seconds, return critical. Disabled
                          by default.
  -t, --timeout=          Global timeout in seconds. If a successful DNS query takes longer, exit early and return
                          unknown. (default: 30)
  -T, --query-timeout=    Timeout in seconds for each DNS query, including retransmissions. If exceeded, try the next
                          query instead of exiting. Can be set in resolv.conf. Default: 5 seconds.
  -a, --attempts=         Packets to send for each DNS query before treating it as unanswered. Can be set in
                          resolv.conf. Default: 2 attempts.

Help Options:
  -h, --help              Show this help message

Examples

Default Check

Alert if the DNS server does not respond:

check_dns -H labs.consol.de
OK - labs.consol.de returns 94.185.89.33 (A)

Check a specific record type on a specific server:

check_dns -H consol.de -q MX -s 1.1.1.1
OK - consol.de returns mail.consol.de. (MX)

Example using check_snclient and Naemon

Naemon Config

define command{
    command_name         check_snclient
    command_line         $USER1$/check_snclient -k -p 'your-password' -u 'https://$HOSTADDRESS$:8443' $ARG1$ $ARG2$
}

define service {
    host_name            testhost
    service_description  check_dns
    use                  generic-service
    check_command        check_snclient!check_dns!'-H' 'omd.consol.de'
}