Docs: Better explaination for zones.d and apply rule workaround

refs #12217
This commit is contained in:
Michael Friedrich 2016-07-25 15:38:50 +02:00
parent 3f9dfcb57a
commit 162931a1b4
1 changed files with 5 additions and 37 deletions

View File

@ -472,45 +472,13 @@ 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)
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"
}
[Apply rules](3-monitoring-basics.md#using-apply) in zone directories underneath `zones.d`
also match against objects defined outside of that particular zone directory.
To work around this issue you can use an `assign where` rule to limit the apply rule to
a specific zone:
assign where host.zone == "dmz1-checker"
## <a id="cluster-health-check"></a> Cluster Health Check