Skip to content

Instantly share code, notes, and snippets.

@mdcollins05
Created February 19, 2016 23:37
Show Gist options
  • Save mdcollins05/8298e2433dd7b523a8eb to your computer and use it in GitHub Desktop.
Save mdcollins05/8298e2433dd7b523a8eb 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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment