Tuesday, January 24, 2012

How to enable check dns on nagios server

Sponsored Links

This post explains how to enable check_dns for client systems on a nagios server.

check_dns command checks whether dns is working or not  in a system by checking resolution of a domain to it. If it is resolving it means dns is working properly in the system.

Following is the syntax of the command you can use to check prior to the configuration.

/usr/local/nagios/libexec/check_dns -H IP_address_of_system_to_check -s google.com
it checks the server whether google.com is resolving from it.

For the command to work you have to add the following entry in commands.cfg

[root@nagios-1-1 objects]# vi commands.cfg
### check dns ###
define command {
        command_name    check_dns
        command_line    $USER1$/check_dns -H $ARG1$ -s $HOSTADDRESS$
}
[root@nagios-1-1 objects]#

Now add the server(server to check the dns) to hosts.cfg
[root@nagios-1-1 objects]# vi hosts.cfg
define host{
host_name            dns.server
alias                      dns.server
address                 178.x.x.x
use                        basic-host
contact_groups      admins
}
[root@nagios-1-1 objects]#

Now on services.cfg add as follows
[root@nagios-1-1 objects]# vi services.cfg
### Check DNS ###
define service{
        use                                       basic-service
        host_name                           dns.server
        contact_groups                    admins
        service_description              CHECK DNS for google.com on  dns.server
        check_command                 check_dns!google.com
}
[root@nagios-1-1 objects]#

Thats it. Now verify the configuration and restart the service
#service nagios restart
Sponsored Links

No comments:

Post a Comment

Be nice. That's all.