Skip to content

Instantly share code, notes, and snippets.

@DirkHeinke
Created August 21, 2015 14:57
Show Gist options
  • Save DirkHeinke/8389ab3eb5a971581607 to your computer and use it in GitHub Desktop.
Save DirkHeinke/8389ab3eb5a971581607 to your computer and use it in GitHub Desktop.
icinga2 slack
object NotificationCommand "slack-overlayr-host-notification" {
import "plugin-notification-command"
command = [ "/usr/local/bin/slack_nagios.pl" ]
arguments = {
"-field" = "slack_channel=#general"
}
env = {
ICINGA_HOSTALIAS = "$host.display_name$"
ICINGA_HOSTSTATE = "$host.state$"
ICINGA_HOSTOUTPUT = "$host.output$"
ICINGA_NOTIFICATIONTYPE = "$notification.type$"
}
}
object NotificationCommand "slack-overlayr-service-notification" {
import "plugin-notification-command"
command = [ "/usr/local/bin/slack_nagios.pl" ]
arguments = {
"-field" = "slack_channel=#general"
}
env = {
ICINGA_HOSTALIAS = "$host.display_name$"
ICINGA_SERVICEDESC = "$service.display_name$"
ICINGA_SERVICESTATE = "$service.state$"
ICINGA_SERVICEOUTPUT= "$service.output$"
ICINGA_NOTIFICATIONTYPE = "$notification.type$"
}
}
apply Notification "slack-overlayr" to Host {
import "slack-overlayr-host-notification"
users = [ "icingaadmin" ]
assign where host.name.contains("overlayr")
}
apply Notification "slack-overlayr" to Service {
import "slack-overlayr-service-notification"
users = [ "icingaadmin" ]
assign where host.name.contains("overlayr")
}
template Notification "slack-overlayr-host-notification" {
command = "slack-overlayr-host-notification"
states = [ Up, Down ]
types = [ Problem, Acknowledgement, Recovery, Custom,
FlappingStart, FlappingEnd,
DowntimeStart, DowntimeEnd, DowntimeRemoved ]
period = "24x7"
}
template Notification "slack-overlayr-service-notification" {
command = "slack-overlayr-service-notification"
states = [ OK, Warning, Critical, Unknown ]
types = [ Problem, Acknowledgement, Recovery, Custom,
FlappingStart, FlappingEnd,
DowntimeStart, DowntimeEnd, DowntimeRemoved ]
period = "24x7"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment