Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to use the Nagios plugin check_dns, so when I look at the command definition to it

define command {
  command_name    check_dns
  command_line    $USER1$/check_dns -H $HOSTADDRESS$ -s $NAMESERVERHOSTADDRESS$ -a $EXPECTEDIPADDRESS$
}

I see that $NAMESERVERHOSTADDRESS$ is not a standard macro, so I am not sure what to put as command_line and what to put in the service definition.

define service {
  use                     generic-service
  name                    check_dns
  host_name               ns.example.com
  service_description     Checks DNS
  check_command           check_dns
  contact_groups          linux-admins
}

The goal is to let the Nagios monitor host ask ns.example.com to lookup test.example.com to see if the resolves to the expected IP.

Question

Should I replace/hardcode $NAMESERVERHOSTADDRESS$ in the command definition, with the value I want?

Or should the value of $NAMESERVERHOSTADDRESS$ be defined in the service definition? And if so, how?

share|improve this question
1  
Could you clarify what you're using check_dns for? Are you testing that your DNS server works, or are you testing that a certain host name resolves properly? –  brent May 3 '12 at 14:59
    
Good point. Post have been updated. –  Sandra May 3 '12 at 15:02
    
Do you define your host's address as an IP in the define host, or FQDNs? –  brent May 3 '12 at 15:10

1 Answer 1

up vote 2 down vote accepted

I don't have such a definition in my server. You can change the definition to use $ARGn$ like:

define command {
  command_name    check_dns
  command_line    $USER1$/check_dns -H $HOSTADDRESS$ -s $ARG1$ -a $ARG2$
}

Then, you can use it the service definition like:

define service {
  use                     generic-service
  name                    check_dns
  host_name               ns.example.com
  service_description     Checks DNS
  check_command           check_dns!name_server!expected_address
  contact_groups          linux-admins
}

You need to replace name_server and expected_address with the actual values.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.