]> granicus.if.org Git - icinga2/commitdiff
Fix incorrect documentation about apply rules in zones.d directories
authorMichael Friedrich <michael.friedrich@netways.de>
Mon, 25 Jul 2016 08:41:21 +0000 (10:41 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Mon, 25 Jul 2016 08:56:14 +0000 (10:56 +0200)
Provides an example how it is done too.

fixes #12217

doc/13-distributed-monitoring-ha.md

index eddf975e4f6330b8a7fa28d43aae5f6a23ae6081..931e4212893e8df786c5112fe35d8099548ed044 100644 (file)
@@ -427,9 +427,8 @@ the actual configuration organization:
 * 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,
 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.
-* 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`.
 
 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)
 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