Introduction
This documentation attempts to explain how you can exploit the (somewhat) hidden features template-based object definitions to save your sanity. How so, you ask? Several types of objects allow you to specify multiple host names and/or hostgroup names in definitions, allowing you to "copy" the object defintion to multiple hosts or services. I'll cover each type of object that supports these features seperately. For starters, the object types which support this time-saving feature are as follows:
Object types that are not listed above do not support the features I'm about to describe. Host and service dependency definitions may support them in the future, but not yet.
Services
Multiple Hosts: If you want to create identical services that are assigned to multiple hosts, you can specify multiple hosts in the host_name directive as follows:
define service{ host_name HOST1,HOST2,HOST3,...,HOSTN service_description SOMESERVICE other service directives ... }
The definition above would create a service called SOMESERVICE on hosts HOST1 through HOSTN. All the instances of the SOMESERVICE service would be identical (i.e. have the same check command, max check attempts, notification period, etc.).
All Hosts In Multiple Hostgroups: If you want to create identical services that are assigned to all hosts in one or more hostgroups, you can do so by creating a single service definition. How? The hostgroup_name directive allows you to specify the name of one or more hostgroups that the service should be created for:
define service{ hostgroup_name HOSTGROUP1,HOSTGROUP2,...,HOSTGROUPN service_description SOMESERVICE other service directives ... }
The definition above would create a service called SOMESERVICE on all hosts that are members of hostgroups HOSTGROUP1 through HOSTGROUPN. All the instances of the SOMESERVICE service would be identical (i.e. have the same check command, max check attempts, notification period, etc.).
All Hosts: If you want to create identical services that are assigned to all hosts that are defined in your configuration files, you can use a wildcard in the host_name directive as follows:
define service{ host_name * service_description SOMESERVICE other service directives ... }
The definition above would create a service called SOMESERVICE on all hosts that are defined in your configuration files. All the instances of the SOMESERVICE service would be identical (i.e. have the same check command, max check attempts, notification period, etc.).
Service Escalations
Multiple Hosts: If you want to create service escalations for services of the same name/description that are assigned to multiple hosts, you can specify multiple hosts in the host_name directive as follows:
define serviceescalation{ host_name HOST1,HOST2,HOST3,...,HOSTN service_description SOMESERVICE other escalation directives ... }
The definition above would create a service escalation for services called SOMESERVICE on hosts HOST1 through HOSTN. All the instances of the service escalation would be identical (i.e. have the same contact groups, notification interval, etc.).
All Hosts In Multiple Hostgroups: If you want to create service escalations for services of the same name/description that are assigned to all hosts in in one or more hostgroups, you can do use the hostgroup_name directive as follows:
define serviceescalation{ hostgroup_name HOSTGROUP1,HOSTGROUP2,...,HOSTGROUPN service_description SOMESERVICE other escalation directives ... }
The definition above would create a service escalation for services called SOMESERVICE on all hosts that are members of hostgroups HOSTGROUP1 through HOSTGROUPN. All the instances of the service escalation would be identical (i.e. have the same contact groups, notification interval, etc.).
All Hosts: If you want to create identical service escalations for services of the same name/description that are assigned to all hosts that are defined in your configuration files, you can use a wildcard in the host_name directive as follows:
define serviceescalation{ host_name * service_description SOMESERVICE other escalation directives ... }
The definition above would create a service escalation for all services called SOMESERVICE on all hosts that are defined in your configuration files. All the instances of the service escalation would be identical (i.e. have the same contact groups, notification interval, etc.).
Host Escalations
Multiple Hosts: If you want to create host escalations for multiple hosts, you can specify multiple hosts in the host_name directive as follows:
define hostescalation{ host_name HOST1,HOST2,HOST3,...,HOSTN other escalation directives ... }
The definition above would create a host escalation for hosts HOST1 through HOSTN. All the instances of the host escalation would be identical (i.e. have the same contact groups, notification interval, etc.).
All Hosts In Multiple Hostgroups: If you want to create host escalations for all hosts in in one or more hostgroups, you can do use the hostgroup_name directive as follows:
define hostescalation{ hostgroup_name HOSTGROUP1,HOSTGROUP2,...,HOSTGROUPN other escalation directives ... }
The definition above would create a host escalation on all hosts that are members of hostgroups HOSTGROUP1 through HOSTGROUPN. All the instances of the host escalation would be identical (i.e. have the same contact groups, notification interval, etc.).
All Hosts: If you want to create identical host escalations for all hosts that are defined in your configuration files, you can use a wildcard in the host_name directive as follows:
define hostescalation{ host_name * other escalation directives ... }
The definition above would create a hosts escalation for all hosts that are defined in your configuration files. All the instances of the host escalation would be identical (i.e. have the same contact groups, notification interval, etc.).
Hostgroup Escalations
Multiple Hostgroups: If you want to create identical hostgroup escalations that are assigned to multiple hostgroups, you can specify multiple hostgroups in the hostgroup_name directive as follows:
define hostgroupescalation{ hostgroup_name HOSTGROUP1,HOSTGROUP2,...,HOSTGROUPN other escalation directives ... }
The definition above would create a seperate hostgroup escalation for hostgroups HOSTGROUP1 through HOSTGROUPN. All the instances of the hostgroup escalation would be identical (i.e. contact groups, notification interval, etc.).