1 Introduction

1.1 Goals

1.2 Notes

2 Lab

We're going to be adding the DNS servers, which we installed earlier this week, to Nagios.

Go to the Nagios config directory

$ cd /etc/nagios3/conf.d

Create a new file for DNS servers monitoring:

Change the following below:
    MM: your group number
    SS:     group number of your slave server
    MYTLD:  your zone name
$ sudo editor dns-servers.cfg

Create the following definition:

### Define the host server

define host{
        use                     generic-host
        host_name               auth1.grpMM
        alias                   master
        address                 %PREFIX%.MM.1
}

define host{
        use                     generic-host
        host_name               resolv.grpMM
        alias                   cache
        address                 %PREFIX%.MM.3
}

## If you didn't configure auth2, don't list it

define host{
        use                     generic-host
        host_name               auth2.grpSS
        alias                   slave
        address                 %PREFIX%.SS.2
}

## Our secondary in another group (replace S/SS with the group number)

define host{
        use                     generic-host
        host_name               auth1.grpSS
        alias                   remote-slave
        address                 %PREFIX%.SS.1
}

Save the file and exit.

Verify the configuration so far using:

$ sudo nagios3 -v /etc/nagios3/nagios.cfg

Make sure there are no errors.

Now, edit the file hostgroups_nagios2.cfg, and add the following host group at the end.

$ sudo editor hostgroups_nagios2.cfg

Add the following:

### Define the group

define hostgroup{
        hostgroup_name  dns-servers
        alias           DNS Servers
        members         auth1.grpMM,resolv.grpMM,auth1.grpSS
}

Save the file and exit - remember to check the configuration with:

$ sudo nagios3 -v /etc/nagios3/nagios.cfg

Now, edit the file services_nagios2.cfg, and add the following at the end.

Remember to replace MYTLD with the name of your domain!

define service {
   use                   generic-service   ; Name of service template to use
   hostgroup_name        dns-servers
   service_description   PING
   check_command         check_ping!100.0,20%!500.0,60%
}

define service {
   use                   generic-service    ; Name of service template to use
   hostgroup_name        dns-servers
   service_description   Check DNS
   check_command         check_dig!www.MYTLD
}

Again, verify the configuration!

Finally, it's time to restart Nagios:

$ sudo service nagios3 restart

Go to the web interface, and verify that it is working!