Skip to content

Instantly share code, notes, and snippets.

@ronindesign
Forked from mdcollins05/pagerduty-icinga2.conf
Created February 23, 2016 21:23
Show Gist options
  • Save ronindesign/7015e244055c6e7ebab3 to your computer and use it in GitHub Desktop.
Save ronindesign/7015e244055c6e7ebab3 to your computer and use it in GitHub Desktop.
object User "pagerduty" {
pager = "SERVICE_KEY_HERE"
groups = [ "icingaadmins" ]
display_name = "PagerDuty Notification User"
states = [ OK, Warning, Critical, Unknown ]
types = [ Problem, Recovery ]
}
object NotificationCommand "notify-service-by-pagerduty" {
import "plugin-notification-command"
command = "/usr/share/pdagent-integrations/bin/pd-nagios -i \"event_source=service;host_name=$host.name$;service_desc=$service.name$\" -n service -k $user.pager$ -t $notification.type$ -f SERVICEDESC=$service.name$ -f SERVICESTATE=$service.state$ -f HOSTNAME=$host.name$ -f SERVICEOUTPUT=$s$"
}
object NotificationCommand "notify-host-by-pagerduty" {
import "plugin-notification-command"
command = "/usr/share/pdagent-integrations/bin/pd-nagios -i \"event_source=host;host_name=$host.name$\" -n host -k $user.pager$ -t $notification.type$ -f HOSTNAME=$host.name$ -f HOSTSTATE=$host.state$ -f HOSTOUTPUT=$host.output$"
}
apply Notification "pagerduty-service" to Service {
command = "notify-service-by-pagerduty"
states = [ OK, Warning, Critical, Unknown ]
types = [ Problem, Acknowledgement, Recovery ]
period = "24x7"
users = [ "pagerduty" ]
assign where service.vars.enable_pagerduty == true
}
apply Notification "pagerduty-host" to Host {
command = "notify-host-by-pagerduty"
states = [ Up, Down ]
types = [ Problem, Acknowledgement, Recovery ]
period = "24x7"
users = [ "pagerduty" ]
assign where host.vars.enable_pagerduty == true
}
@ronindesign
Copy link
Author

Added missing trailing " end quote to notify-service-bypagerduty command string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment