2.5 Defining Services to Be Monitored with service

A service in Nagios always consists of the combination of a host and a service name. This combination must be unique. Service names, on the other hand, may occur many times, as long as they are combined with different hosts.

The simplest service consists of a simple ping, which tests whether the relevant host is reachable, and which registers the response time and any packet loss that may occur:

# -- /etc/nagios/mysite/services.cfg
define service{
   host_name                         linux01
   service_description               PING
   check_command                     check_ping!100.0,20%!500.0,60%
   max_check_attempts                3
   normal_check_interval(*)          5
   retry_check_interval(*)           1
   check_period                      24×7
   notification_interval             120
   notification_period(*)            24×7
 notification_options ...

Get Nagios, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.