Created
March 26, 2019 13:26
-
-
Save mr-gosh/1bf93ebaa227db3a4a49704d5a671594 to your computer and use it in GitHub Desktop.
icinga2 commands.conf with mattermost notification problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Command objects */ | |
/* Notification Commands | |
* | |
* Please check the documentation for all required and | |
* optional parameters. | |
*/ | |
object NotificationCommand "mail-host-notification" { | |
command = [ ConfigDir + "/scripts/mail-host-notification.sh" ] | |
arguments += { | |
"-4" = "$notification_address$" | |
"-6" = "$notification_address6$" | |
"-b" = "$notification_author$" | |
"-c" = "$notification_comment$" | |
"-d" = { | |
required = true | |
value = "$notification_date$" | |
} | |
"-f" = { | |
value = "$notification_from$" | |
description = "Set from address. Requires GNU mailutils (Debian/Ubuntu) or mailx (RHEL/SUSE)" | |
} | |
"-i" = "$notification_icingaweb2url$" | |
"-l" = { | |
required = true | |
value = "$notification_hostname$" | |
} | |
"-n" = { | |
required = true | |
value = "$notification_hostdisplayname$" | |
} | |
"-o" = { | |
required = true | |
value = "$notification_hostoutput$" | |
} | |
"-r" = { | |
required = true | |
value = "$notification_useremail$" | |
} | |
"-s" = { | |
required = true | |
value = "$notification_hoststate$" | |
} | |
"-t" = { | |
required = true | |
value = "$notification_type$" | |
} | |
"-v" = "$notification_logtosyslog$" | |
} | |
vars += { | |
notification_address = "$address$" | |
notification_address6 = "$address6$" | |
notification_author = "$notification.author$" | |
notification_comment = "$notification.comment$" | |
notification_type = "$notification.type$" | |
notification_date = "$icinga.long_date_time$" | |
notification_hostname = "$host.name$" | |
notification_hostdisplayname = "$host.display_name$" | |
notification_hostoutput = "$host.output$" | |
notification_hoststate = "$host.state$" | |
notification_useremail = "$user.email$" | |
} | |
} | |
object NotificationCommand "mail-service-notification" { | |
command = [ ConfigDir + "/scripts/mail-service-notification.sh" ] | |
arguments += { | |
"-4" = "$notification_address$" | |
"-6" = "$notification_address6$" | |
"-b" = "$notification_author$" | |
"-c" = "$notification_comment$" | |
"-d" = { | |
required = true | |
value = "$notification_date$" | |
} | |
"-e" = { | |
required = true | |
value = "$notification_servicename$" | |
} | |
"-f" = { | |
value = "$notification_from$" | |
description = "Set from address. Requires GNU mailutils (Debian/Ubuntu) or mailx (RHEL/SUSE)" | |
} | |
"-i" = "$notification_icingaweb2url$" | |
"-l" = { | |
required = true | |
value = "$notification_hostname$" | |
} | |
"-n" = { | |
required = true | |
value = "$notification_hostdisplayname$" | |
} | |
"-o" = { | |
required = true | |
value = "$notification_serviceoutput$" | |
} | |
"-r" = { | |
required = true | |
value = "$notification_useremail$" | |
} | |
"-s" = { | |
required = true | |
value = "$notification_servicestate$" | |
} | |
"-t" = { | |
required = true | |
value = "$notification_type$" | |
} | |
"-u" = { | |
required = true | |
value = "$notification_servicedisplayname$" | |
} | |
"-v" = "$notification_logtosyslog$" | |
} | |
vars += { | |
notification_address = "$address$" | |
notification_address6 = "$address6$" | |
notification_author = "$notification.author$" | |
notification_comment = "$notification.comment$" | |
notification_type = "$notification.type$" | |
notification_date = "$icinga.long_date_time$" | |
notification_hostname = "$host.name$" | |
notification_hostdisplayname = "$host.display_name$" | |
notification_servicename = "$service.name$" | |
notification_serviceoutput = "$service.output$" | |
notification_servicestate = "$service.state$" | |
notification_useremail = "$user.email$" | |
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 = [ ConfigDir + "/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 = [ ConfigDir + "/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$" | |
} | |
} | |
object NotificationCommand "mattermost_service" { | |
import "plugin-notification-command" | |
command = [ PluginContribDir + "/icinga2-mattermost/mattermost.py" ] | |
arguments = { | |
"--channel" = { | |
"description" = "mattermost channel" | |
"required" = true | |
"value" = "$mattermost_channel$" | |
} | |
"--hostalias" = { | |
"required" = true | |
"value" = "$mattermost_hostalias$" | |
} | |
"--notificationtype" = { | |
"required" = true | |
"value" = "$mattermost_notificationtype$" | |
} | |
"--oneline" = { | |
"set_if" = "$mattermost_oneline$" | |
} | |
"--servicedesc" = { | |
"required" = true | |
"value" = "$mattermost_servicedesc$" | |
} | |
"--serviceoutput" = { | |
"required" = true | |
"value" = "$mattermost_serviceoutput$" | |
} | |
"--servicestate" = { | |
"required" = true | |
"value" = "$mattermost_servicestate$" | |
} | |
"--url" = { | |
"description" = "mattermost incomming webhook url" | |
"required" = true | |
"value" = "$mattermost_url$" | |
} | |
} | |
vars += { | |
"mattermost_channel" = "$user.vars.channel$" | |
"mattermost_hostalias" = "$host.display_name$" | |
"mattermost_notificationtype" = "$notification.type$" | |
"mattermost_oneline" = "$user.vars.oneline$" | |
"mattermost_servicedesc" = "$service.display_name$" | |
"mattermost_serviceoutput" = "$service.output$" | |
"mattermost_servicestate" = "$service.state$" | |
"mattermost_url" = "$user.vars.url$" | |
} | |
} | |
object NotificationCommand "mattermost_host" { | |
import "plugin-notification-command" | |
command = [ PluginContribDir + "/icinga2-mattermost/mattermost.py" ] | |
arguments = { | |
"--channel" = { | |
"description" = "mattermost channel" | |
"required" = true | |
"value" = "$mattermost_channel$" | |
} | |
"--hostalias" = { | |
"required" = true | |
"value" = "$mattermost_hostalias$" | |
} | |
"--hostoutput" = { | |
"required" = true | |
"value" = "$mattermost_hostoutput$" | |
} | |
"--hoststate" = { | |
"required" = true | |
"value" = "$mattermost_hoststate$" | |
} | |
"--notificationtype" = { | |
"required" = true | |
"value" = "$mattermost_notificationtype$" | |
} | |
"--oneline" = { | |
"set_if" = "$mattermost_oneline$" | |
} | |
"--url" = { | |
"description" = "mattermost incomming webhook url" | |
"required" = true | |
"value" = "$mattermost_url$" | |
} | |
} | |
vars += { | |
"mattermost_channel" = "$user.vars.channel$" | |
"mattermost_hostalias" = "$host.display_name$" | |
"mattermost_hostoutput" = "$host.output$" | |
"mattermost_hoststate" = "$host.state$" | |
"mattermost_notificationtype" = "$notification.type$" | |
"mattermost_oneline" = "$user.vars.oneline$" | |
"mattermost_url" = "$user.vars.url$" | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment