icinga2/doc/3.05-using-templates.md

33 lines
824 B
Markdown
Raw Normal View History

## <a id="using-templates"></a> Using Templates
2013-10-02 09:50:26 +02:00
2014-04-06 10:57:51 +02:00
Templates may be used to apply a set of identical attributes to more than one
object:
2013-10-02 09:50:26 +02:00
2014-03-29 01:13:28 +01:00
template Service "generic-service" {
max_check_attempts = 3
check_interval = 5m
retry_interval = 1m
2014-03-29 01:13:28 +01:00
enable_perfdata = true
2013-10-02 09:50:26 +02:00
}
2014-04-06 10:57:51 +02:00
object Service "ping4" {
import "generic-service"
2014-04-06 10:57:51 +02:00
host_name = "localhost"
check_command = "ping4"
2013-10-02 09:50:26 +02:00
}
2014-04-06 10:57:51 +02:00
object Service "ping6" {
import "generic-service"
2014-04-06 10:57:51 +02:00
host_name = "localhost"
check_command = "ping6"
2013-10-02 09:50:26 +02:00
}
2014-04-06 10:57:51 +02:00
In this example the `ping4` and `ping6` services inherit properties from the
2014-03-29 01:13:28 +01:00
template `generic-service`.
2013-10-02 09:50:26 +02:00
2014-03-29 01:13:28 +01:00
Objects as well as templates themselves can import an arbitrary number of
2013-10-02 09:50:26 +02:00
templates. Attributes inherited from a template can be overridden in the
object if necessary.