2.11 Templates

Nagios categorizes definitions as objects for a very good reason: their features can namely be inherited by other objects—a feature that can save a lot of time otherwise spent typing. You can define a so-called template and pass this on to other objects as a basis from which you only need to describe those details that are different.

This is best illustrated by an example (the parameters that are required for the use of templates are printed in bold):

# -- /etc/nagios/mysite/hosts.cfg
define host{
   name             Generic-Host
   register         0

   check_command           check-host-alive
   max_check_attempts      3
   check_period            24×7
   contact_groups          localadmins
   notification_interval   120
   notification_period     24×7
   notification_options    d, u, r, f
}

With name, the template is ...

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.