Additional documentation fixes for NotificationCommand example.

Fixes #5478
This commit is contained in:
Michael Friedrich 2014-01-15 21:04:01 +01:00
parent df059086e4
commit c38c81ac3f
2 changed files with 34 additions and 43 deletions

View File

@ -56,35 +56,29 @@ your environment.
There are various macros available at runtime execution of the `NotificationCommand`. There are various macros available at runtime execution of the `NotificationCommand`.
The example below may or may not fit your needs. The example below may or may not fit your needs.
object NotificationCommand "mail-notification" inherits "plugin-notification-command" { object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" {
command = [ command = [ (IcingaSysconfDir + "/icinga2/scripts/mail-notification.sh") ],
"/usr/bin/printf",
"\"%b\"", export_macros = [
{{{\"***** Icinga ***** "NOTIFICATIONTYPE",
"SERVICEDESC",
Notification Type: $NOTIFICATIONTYPE$ "HOSTALIAS",
"HOSTADDRESS",
Service: $SERVICEDESC$ "SERVICESTATE",
Host: $HOSTALIAS$ "LONGDATETIME",
Address: $HOSTADDRESS$ "SERVICEOUTPUT",
State: $SERVICESTATE$ "NOTIFICATIONAUTHORNAME",
"NOTIFICATIONCOMMENT",
Date/Time: $LONGDATETIME$ "HOSTDISPLAYNAME",
"SERVICEDISPLAYNAME",
Additional Info: $SERVICEOUTPUT$ "USEREMAIL"
Comment: [$NOTIFICATIONAUTHORNAME$] $NOTIFICATIONCOMMENT$\"}}},
"/bin/mail",
"-s",
"\"$NOTIFICATIONTYPE$ - $HOSTDISPLAYNAME$ - $SERVICEDISPLAYNAME$ is $SERVICESTATE$\"",
"$USEREMAIL$"
] ]
} }
> **Note** The command attribute in the `mail-service-notification` command refers to the
> shell script installed into `/etc/icinga2/scripts/mail-notification.sh`.
> Alternatively you can use the `export_macros` attributes to export all required The macros specified in the `export_macros` array are exported as environment
> macros into the environment. variables and can be used in the notification script.
You can add all shared attributes to a `Notification` template which is inherited You can add all shared attributes to a `Notification` template which is inherited
to the defined notifications. That way you'll save duplicated attributes in each to the defined notifications. That way you'll save duplicated attributes in each

View File

@ -418,24 +418,21 @@ A notification command definition.
Example: Example:
object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" { object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" {
command = [ command = [ (IcingaSysconfDir + "/icinga2/scripts/mail-notification.sh") ],
"/opt/bin/send-mail-notification",
"$USEREMAIL$",
"$NOTIFICATIONTYPE$ - $HOSTNAME$ - $SERVICEDESC$ - $SERVICESTATE$",
{{{***** Icinga *****
Notification Type: $NOTIFICATIONTYPE$ export_macros = [
"NOTIFICATIONTYPE",
Service: $SERVICEDESC$ "SERVICEDESC",
Host: $HOSTALIAS$ "HOSTALIAS",
Address: $HOSTADDRESS$ "HOSTADDRESS",
State: $SERVICESTATE$ "SERVICESTATE",
"LONGDATETIME",
Date/Time: $LONGDATETIME$ "SERVICEOUTPUT",
"NOTIFICATIONAUTHORNAME",
Additional Info: $SERVICEOUTPUT$ "NOTIFICATIONCOMMENT",
"HOSTDISPLAYNAME",
Comment: [$NOTIFICATIONAUTHORNAME$] $NOTIFICATIONCOMMENT$}}} "SERVICEDISPLAYNAME",
"USEREMAIL"
] ]
} }