mirror of https://github.com/Icinga/icinga2.git
Additional documentation fixes for NotificationCommand example.
Fixes #5478
This commit is contained in:
parent
df059086e4
commit
c38c81ac3f
|
@ -56,35 +56,29 @@ your environment.
|
|||
There are various macros available at runtime execution of the `NotificationCommand`.
|
||||
The example below may or may not fit your needs.
|
||||
|
||||
object NotificationCommand "mail-notification" inherits "plugin-notification-command" {
|
||||
command = [
|
||||
"/usr/bin/printf",
|
||||
"\"%b\"",
|
||||
{{{\"***** Icinga *****
|
||||
|
||||
Notification Type: $NOTIFICATIONTYPE$
|
||||
|
||||
Service: $SERVICEDESC$
|
||||
Host: $HOSTALIAS$
|
||||
Address: $HOSTADDRESS$
|
||||
State: $SERVICESTATE$
|
||||
|
||||
Date/Time: $LONGDATETIME$
|
||||
|
||||
Additional Info: $SERVICEOUTPUT$
|
||||
|
||||
Comment: [$NOTIFICATIONAUTHORNAME$] $NOTIFICATIONCOMMENT$\"}}},
|
||||
"/bin/mail",
|
||||
"-s",
|
||||
"\"$NOTIFICATIONTYPE$ - $HOSTDISPLAYNAME$ - $SERVICEDISPLAYNAME$ is $SERVICESTATE$\"",
|
||||
"$USEREMAIL$"
|
||||
object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" {
|
||||
command = [ (IcingaSysconfDir + "/icinga2/scripts/mail-notification.sh") ],
|
||||
|
||||
export_macros = [
|
||||
"NOTIFICATIONTYPE",
|
||||
"SERVICEDESC",
|
||||
"HOSTALIAS",
|
||||
"HOSTADDRESS",
|
||||
"SERVICESTATE",
|
||||
"LONGDATETIME",
|
||||
"SERVICEOUTPUT",
|
||||
"NOTIFICATIONAUTHORNAME",
|
||||
"NOTIFICATIONCOMMENT",
|
||||
"HOSTDISPLAYNAME",
|
||||
"SERVICEDISPLAYNAME",
|
||||
"USEREMAIL"
|
||||
]
|
||||
}
|
||||
|
||||
> **Note**
|
||||
>
|
||||
> Alternatively you can use the `export_macros` attributes to export all required
|
||||
> macros into the environment.
|
||||
The command attribute in the `mail-service-notification` command refers to the
|
||||
shell script installed into `/etc/icinga2/scripts/mail-notification.sh`.
|
||||
The macros specified in the `export_macros` array are exported as environment
|
||||
variables and can be used in the notification script.
|
||||
|
||||
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
|
||||
|
|
|
@ -418,24 +418,21 @@ A notification command definition.
|
|||
Example:
|
||||
|
||||
object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" {
|
||||
command = [
|
||||
"/opt/bin/send-mail-notification",
|
||||
"$USEREMAIL$",
|
||||
"$NOTIFICATIONTYPE$ - $HOSTNAME$ - $SERVICEDESC$ - $SERVICESTATE$",
|
||||
{{{***** Icinga *****
|
||||
command = [ (IcingaSysconfDir + "/icinga2/scripts/mail-notification.sh") ],
|
||||
|
||||
Notification Type: $NOTIFICATIONTYPE$
|
||||
|
||||
Service: $SERVICEDESC$
|
||||
Host: $HOSTALIAS$
|
||||
Address: $HOSTADDRESS$
|
||||
State: $SERVICESTATE$
|
||||
|
||||
Date/Time: $LONGDATETIME$
|
||||
|
||||
Additional Info: $SERVICEOUTPUT$
|
||||
|
||||
Comment: [$NOTIFICATIONAUTHORNAME$] $NOTIFICATIONCOMMENT$}}}
|
||||
export_macros = [
|
||||
"NOTIFICATIONTYPE",
|
||||
"SERVICEDESC",
|
||||
"HOSTALIAS",
|
||||
"HOSTADDRESS",
|
||||
"SERVICESTATE",
|
||||
"LONGDATETIME",
|
||||
"SERVICEOUTPUT",
|
||||
"NOTIFICATIONAUTHORNAME",
|
||||
"NOTIFICATIONCOMMENT",
|
||||
"HOSTDISPLAYNAME",
|
||||
"SERVICEDISPLAYNAME",
|
||||
"USEREMAIL"
|
||||
]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue