System information

Monitoring with Nagios 53
3.3.1 Object Definition Files
In addition to those configuration files Nagios comes with very flexible and highly
customizable configuration files called Object Definition configuration files. Those
configuration files are very important since they define the following objects:
Hosts
Services
Contacts
The flexibility lies in the fact that objects are easily enhanceable. Imagine you are re-
sponsible for a host with only one service running. However, you want to install an-
other service on the same host machine and you want to monitor that service as well.
It is possible to add another service object and assign it to the host object without
huge efforts.
Right after the installation, Nagios offers default templates for object definition con-
figuration files. They can be found at /etc/nagios/objects. In the following
see a description on how hosts, services and contacts are added:
Example3.1: A Host Object Definition
define host {
name SRV1
host_name SRV1
address 192.168.0.1
use generic-host
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
notification_period workhours
notification_interval 120
notification_options d,u,r
}
The host_name option defines a name to identify the host that has to be monitored.
address is the IP address of this host. The use statement tells Nagios to inherit
other configuration values from the generic-host template. check_period defines
whether the machine has to be monitored 24x7. check_interval makes Nagios
checking the service every 5 minutes and retry_interval tells Nagios to sched-
ule host check retries at 1 minute intervals. Nagios tries to execute the checks multi-
ple times when they do not pass. You can define how many attempts Nagios should do