Network monitoring: Nagios

Add a host

by ross at 09:17:57 on December 29, 2011

Create directory /usr/local/etc/nagios/hosts.

Create /usr/local/etc/nagios/hosts/host1.example.com.cfg:

define host {
        use                     linux-server ; or freebsd-server, windows-server, device
        host_name               host1.example.com
        alias                   Host 1
        address                 host1.example.com
}

define service {
        use                     generic-service
        host_name               host1.example.com
        service_description     PING
        check_command           check_ping!100.0,20%!500.0,60%
}

define service {
        use                     generic-service
        host_name               host1.example.com
        service_description     HTTP
        check_command           check_http
}

define service {
        use                     generic-service
        host_name               host1.example.com
        service_description     SMTP
        check_command           check_smtp
}

define service {
        use                     generic-service
        host_name               host1.example.com
        service_description     IMAP
        check_command           check_imap
}

With the help of this file we will monitor ping, http, smtp and imap services of host1.example.com.

Add config files for other servers and devices to this directory.

Have a look at objects/commands.cfg — it contains all the available check_commands.

Restart Nagios:

# service nagios restart

 

Comments