diff --git a/doc/03-monitoring-basics.md b/doc/03-monitoring-basics.md index 293aabdd6..eb8b6c197 100644 --- a/doc/03-monitoring-basics.md +++ b/doc/03-monitoring-basics.md @@ -1690,7 +1690,6 @@ information. Name | Description -------------------------------|--------------------------------------- - `notification_address` | **Required.** The host's IPv4 address. Defaults to `$address$`. `notification_date` | **Required.** Date and time. Defaults to `$icinga.long_date_time$`. `notification_hostname` | **Required.** The host's `FQDN`. Defaults to `$host.name$`. `notification_hostdisplayname` | **Required.** The host's display name. Defaults to `$host.display_name$`. @@ -1698,6 +1697,7 @@ information. `notification_useremail` | **Required.** The notification's recipient(s). Defaults to `$user.email$`. `notification_hoststate` | **Required.** Current state of host. Defaults to `$host.state$`. `notification_type` | **Required.** Type of notification. Defaults to `$notification.type$`. + `notification_address` | **Optional.** The host's IPv4 address. Defaults to `$address$`. `notification_address6` | **Optional.** The host's IPv6 address. Defaults to `$address6$`. `notification_author` | **Optional.** Comment author. Defaults to `$notification.author$`. `notification_comment` | **Optional.** Comment text. Defaults to `$notification.comment$`. @@ -1716,7 +1716,6 @@ information. Name | Description ----------------------------------|--------------------------------------- - `notification_address` | **Required.** The host's IPv4 address. Defaults to `$address$`. `notification_date` | **Required.** Date and time. Defaults to `$icinga.long_date_time$`. `notification_hostname` | **Required.** The host's `FQDN`. Defaults to `$host.name$`. `notification_servicename` | **Required.** The service name. Defaults to `$service.name$`. @@ -1726,6 +1725,7 @@ information. `notification_useremail` | **Required.** The notification's recipient(s). Defaults to `$user.email$`. `notification_servicestate` | **Required.** Current state of host. Defaults to `$service.state$`. `notification_type` | **Required.** Type of notification. Defaults to `$notification.type$`. + `notification_address` | **Optional.** The host's IPv4 address. Defaults to `$address$`. `notification_address6` | **Optional.** The host's IPv6 address. Defaults to `$address6$`. `notification_author` | **Optional.** Comment author. Defaults to `$notification.author$`. `notification_comment` | **Optional.** Comment text. Defaults to `$notification.comment$`. diff --git a/etc/icinga2/conf.d/commands.conf b/etc/icinga2/conf.d/commands.conf index 11bfa8266..9c5153811 100644 --- a/etc/icinga2/conf.d/commands.conf +++ b/etc/icinga2/conf.d/commands.conf @@ -133,3 +133,55 @@ object NotificationCommand "mail-service-notification" { notification_servicedisplayname = "$service.display_name$" } } + +/* + * If you prefer to use the notification scripts with environment + * variables instead of command line parameters, you can use + * the following commands. They have been updated from < 2.7 + * to support the new notification scripts and should help + * with an upgrade. + * Remove the comment blocks and comment the notification commands above. + */ + +/* + +object NotificationCommand "mail-host-notification" { + command = [ SysconfDir + "/icinga2/scripts/mail-host-notification.sh" ] + + env = { + NOTIFICATIONTYPE = "$notification.type$" + HOSTDISPLAYNAME = "$host.display_name$" + HOSTNAME = "$host.name$" + HOSTADDRESS = "$address$" + HOSTSTATE = "$host.state$" + LONGDATETIME = "$icinga.long_date_time$" + HOSTOUTPUT = "$host.output$" + NOTIFICATIONAUTHORNAME = "$notification.author$" + NOTIFICATIONCOMMENT = "$notification.comment$" + HOSTDISPLAYNAME = "$host.display_name$" + USEREMAIL = "$user.email$" + } +} + +object NotificationCommand "mail-service-notification" { + command = [ SysconfDir + "/icinga2/scripts/mail-service-notification.sh" ] + + env = { + NOTIFICATIONTYPE = "$notification.type$" + SERVICENAME = "$service.name$" + HOSTNAME = "$host.name$" + HOSTDISPLAYNAME = "$host.display_name$" + HOSTADDRESS = "$address$" + SERVICESTATE = "$service.state$" + LONGDATETIME = "$icinga.long_date_time$" + SERVICEOUTPUT = "$service.output$" + NOTIFICATIONAUTHORNAME = "$notification.author$" + NOTIFICATIONCOMMENT = "$notification.comment$" + HOSTDISPLAYNAME = "$host.display_name$" + SERVICEDISPLAYNAME = "$service.display_name$" + USEREMAIL = "$user.email$" + } +} + +*/ +