mirror of https://github.com/Icinga/icinga2.git
1006 B
1006 B
Using Templates
Templates may be used to apply a set of similar settings to more than one object.
For example, rather than manually creating a ping
service object for each of
your hosts you can use templates to avoid having to copy & paste parts of your
configuration:
template Service "generic-service" {
max_check_attempts = 3
check_interval = 5m
retry_interval = 1m
enable_perfdata = true
}
apply Service "ping4" {
import "generic-service"
check_command = "ping4"
assign where host.vars.address
}
apply Service "ping6" {
import "generic-service"
check_command = "ping6"
assign where host.vars.address6
}
In this example both ping4
and ping6
services inherit properties from the
template generic-service
.
Objects as well as templates themselves can import an arbitrary number of templates. Attributes inherited from a template can be overridden in the object if necessary.