2014-02-05 15:53:22 +01:00
|
|
|
## <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" {
|
2014-03-31 18:38:15 +02:00
|
|
|
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" {
|
2014-03-31 18:38:15 +02:00
|
|
|
import "generic-service"
|
2014-04-06 10:57:51 +02:00
|
|
|
|
|
|
|
host_name = "localhost"
|
2014-03-31 18:38:15 +02:00
|
|
|
check_command = "ping4"
|
2013-10-02 09:50:26 +02:00
|
|
|
}
|
|
|
|
|
2014-04-06 10:57:51 +02:00
|
|
|
object Service "ping6" {
|
2014-03-31 18:38:15 +02:00
|
|
|
import "generic-service"
|
2014-04-06 10:57:51 +02:00
|
|
|
|
|
|
|
host_name = "localhost"
|
2014-03-31 18:38:15 +02:00
|
|
|
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.
|