Fix incorrect documentation about apply rules in zones.d directories

Provides an example how it is done too.

fixes #12217
This commit is contained in:
Michael Friedrich 2016-07-25 10:41:21 +02:00
parent 22bb1f406a
commit 463beb9aa8
1 changed files with 39 additions and 2 deletions

View File

@ -427,9 +427,8 @@ the actual configuration organization:
* Generic `Templates`, `timeperiods`, `downtimes` should be synchronized in a global zone as well. * Generic `Templates`, `timeperiods`, `downtimes` should be synchronized in a global zone as well.
* [Apply rules](3-monitoring-basics.md#using-apply) can be synchronized globally. Keep in mind that they are evaluated on each instance, * [Apply rules](3-monitoring-basics.md#using-apply) can be synchronized globally. Keep in mind that they are evaluated on each instance,
and might require additional filters (e.g. `match("icinga2*", NodeName) or similar based on the zone information. and might require additional filters (e.g. `match("icinga2*", NodeName) or similar based on the zone information.
* [Apply rules](3-monitoring-basics.md#using-apply) specified inside zone directories will only affect endpoints in the same zone or below.
* Host configuration must be put into the specific zone directory. * Host configuration must be put into the specific zone directory.
* Duplicated host and service objects (also generated by faulty apply rules) will generate a configuration error. * Duplicated host and service objects (also generated by apply rules) will generate a configuration error.
* Consider using custom constants in your host/service configuration. Each instance may set their local value, e.g. for `PluginDir`. * Consider using custom constants in your host/service configuration. Each instance may set their local value, e.g. for `PluginDir`.
This example specifies the following hierarchy over three levels: This example specifies the following hierarchy over three levels:
@ -473,6 +472,44 @@ If you are planning to synchronize local service health checks inside a zone, lo
[command endpoint](13-distributed-monitoring-ha.md#cluster-health-check-command-endpoint) [command endpoint](13-distributed-monitoring-ha.md#cluster-health-check-command-endpoint)
explainations. explainations.
[Apply rules](3-monitoring-basics.md#using-apply) put into zone directories underneath `zones.d`
must specify the zone where they should be applied to e.g. `assign where host.zone == "dmz1-checker"`.
# tree /etc/icinga2/zones.d
/etc/icinga2/zones.d
├── dmz1-checker
│   ├── hosts.conf
│   ├── apply_services.conf
├── dmz2-checker
│   └── hosts.conf
├── global-templates
│   ├── apply_services.conf
│   ├── commands.conf
├── ha-master
│   └── health.conf
└── README
Global apply rules:
# cat /etc/icinga2/zones.d/global-templates/apply_services.conf
apply Service "ping4" {
check_command = "ping4"
assign where host.address
}
Zone-specific apply rules:
# cat /etc/icinga2/zones.d/dmz1-checker/apply_services.conf
apply Service "mysql" {
check_command = "mysql"
assign where host.zone == "dmz1-checker" && host.vars.db_type == "mysql"
}
## <a id="cluster-health-check"></a> Cluster Health Check ## <a id="cluster-health-check"></a> Cluster Health Check