]> granicus.if.org Git - icinga2/commitdiff
Documentation: Add a better example for apply rules in monitoring basics.
authorMichael Friedrich <michael.friedrich@netways.de>
Tue, 20 May 2014 11:56:49 +0000 (13:56 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Tue, 20 May 2014 11:56:49 +0000 (13:56 +0200)
Refs #5827

doc/3-monitoring-basics.md

index 78ca768917011db85b4d35257dbbb845774e8b2a..5725eb2c1879d1a115a79c7af801f61873f9ae2a 100644 (file)
@@ -117,19 +117,37 @@ object if necessary.
 Instead of assigning each object (`Service`, `Notification`, `Dependency`, `ScheduledDowntime`)
 based on attribute identifiers for example `host_name` objects can be [applied](#apply).
 
-    apply Service "ping4" {
+    apply Service "load" {
       import "generic-service"
 
-      check_command = "ping4"
+      check_command = "load"
 
-      assign where "generic-host" in host.templates
-      ignore where host.address == ""
+      assign where "linux-server" in host.groups
+      ignore where host.vars.no_load_check
     }
 
-In this example the `ping4` service will be created as object for all hosts importing
-the `generic-host` template. If the `address` attribute is not set, the host will be
+In this example the `load` service will be created as object for all hosts in the `linux-server`
+host group. If the `no_load_check` custom attribute is set, the host will be
 ignored.
 
+Notifications are applied to specific targets (`Host` or `Service`) and work in a similar
+manner:
+
+    apply Notification "mail-noc" to Service {
+      import "mail-service-notification"
+      command = "mail-service-notification"
+      user_groups = [ "noc" ]
+
+      assign where service.vars.sla == "24x7"
+    }
+
+In this example the `mail-noc` notification will be created as object for all services having the
+`sla` custom attribute set to `24x7`. The notification command is set to `mail-service-notification`
+and all members of the user group `noc` will get notified.
+
+`Dependency` and `ScheduledDowntime` objects can be applied in a similar fashion.
+
+
 ## <a id="groups"></a> Groups
 
 Groups are used for combining hosts, services, and users into
@@ -190,7 +208,7 @@ the user groups are associated as attributes in `Notification` objects.
 
 If there is a certain number of hosts, services or users matching a pattern
 it's reasonable to assign the group object to these members.
-Details on the `assign where` syntax can be found [here]
+Details on the `assign where` syntax can be found [here](#group-assign)
 
     object HostGroup "mssql" {
       display_name = "MSSQL Servers"