]> granicus.if.org Git - icinga2/blob - doc/3.05-using-templates.md
Remove the 'Icinga' prefix for global constants.
[icinga2] / doc / 3.05-using-templates.md
1 ## <a id="using-templates"></a> Using Templates
2
3 Templates may be used to apply a set of identical attributes to more than one
4 object:
5
6     template Service "generic-service" {
7       max_check_attempts = 3
8       check_interval = 5m
9       retry_interval = 1m
10       enable_perfdata = true
11     }
12
13     object Service "ping4" {
14       import "generic-service"
15
16       host_name = "localhost"
17       check_command = "ping4"
18     }
19
20     object Service "ping6" {
21       import "generic-service"
22
23       host_name = "localhost"
24       check_command = "ping6"
25     }
26
27 In this example the `ping4` and `ping6` services inherit properties from the
28 template `generic-service`.
29
30 Objects as well as templates themselves can import an arbitrary number of
31 templates. Attributes inherited from a template can be overridden in the
32 object if necessary.