### <a id="objecttype-notification"></a> Notification
Notification objects are used to specify how users should be notified in case
-of service state changes and other events.
+of host and service state changes and other events.
> **Best Practice**
>
-> Rather than creating a `Notification` object for a specific service it is usually easier
-> to just create a `Notification` template and use the `apply` keyword to assign the
-> notification to a number of services.
+> Rather than creating a `Notification` object for a specific host or service it is
+> usually easier to just create a `Notification` template and use the `apply` keyword
+> to assign the notification to a number of hosts or services. Use the `to` keyword
+> to set the specific target type for `Host` or `Service`.
Example:
Name | Description
--------------------------|----------------
host_name | **Required.** The name of the host this notification belongs to.
- service_name | **Required.** The short name of the service this notification belongs to.
+ service_name | **Optional.** The short name of the service this notification belongs to. If omitted this notification object is treated as host notification.
vars | **Optional.** A dictionary containing custom attributes that are specific to this notification object.
users | **Optional.** A list of user names who should be notified.
user_groups | **Optional.** A list of user group names who should be notified.
> **Best Practice**
>
-> Rather than creating a `Dependency` object for a specific service it is usually easier
+> Rather than creating a `Dependency` object for a specific host or service it is usually easier
> to just create a `Dependency` template and use the `apply` keyword to assign the
-> dependency to a number of services.
+> dependency to a number of hosts or services. Use the `to` keyword to set the specific target
+> type for `Host` or `Service`.
Example:
Name |Description
----------------|----------------
parent_host_name |**Required.** The parent host.
- parent_service_name |**Optional.** The parent service. When not specified the host's check service is used.
+ parent_service_name |**Optional.** The parent service. If omitted this dependency object is treated as host dependency.
child_host_name |**Required.** The child host.
- child_service_name |**Optional.** The child service. When not specified the host's check service is used.
+ child_service_name |**Optional.** The child service. If omitted this dependency object is treated as host dependency.
disable_checks |**Optional.** Whether to disable checks when this dependency fails. Defaults to false.
disable_notifications|**Optional.** Whether to disable notifications when this dependency fails. Defaults to true.
period |**Optional.** Time period during which this dependency is enabled.
> **Best Practice**
>
-> Rather than creating a `ScheduledDowntime` object for a specific service it is usually easier
+> Rather than creating a `ScheduledDowntime` object for a specific host or service it is usually easier
> to just create a `ScheduledDowntime` template and use the `apply` keyword to assign the
-> scheduled downtime to a number of services.
+> scheduled downtime to a number of hosts or services. Use the `to` keyword to set the specific target
+> type for `Host` or `Service`.
Example:
Name |Description
----------------|----------------
- host_name |**Required.** The name of the host this notification belongs to.
- service_name |**Required.** The short name of the service this notification belongs to.
+ host_name |**Required.** The name of the host this scheduled downtime belongs to.
+ service_name |**Optional.** The short name of the service this scheduled downtime belongs to. If omitted this downtime object is treated as host downtime.
author |**Required.** The author of the downtime.
comment |**Required.** A comment for the downtime.
fixed |**Optional.** Whether this is a fixed downtime. Defaults to true.
Example:
- object FileLogger "my-debug-file" {
+ object FileLogger "debug-file" {
severity = "debug"
- path = "/var/log/icinga2/icinga2-debug.log"
+ path = "/var/log/icinga2/debug.log"
}
Attributes:
Example:
- object SyslogLogger "my-crit-syslog" {
+ object SyslogLogger "crit-syslog" {
severity = "critical"
}