Skip to content

Instantly share code, notes, and snippets.

@KozzyKoder
Last active June 29, 2018 14:25
Show Gist options
  • Save KozzyKoder/4f1012efbf3d8b1f146eedaade57bb54 to your computer and use it in GitHub Desktop.
Save KozzyKoder/4f1012efbf3d8b1f146eedaade57bb54 to your computer and use it in GitHub Desktop.
template common_templates {
pdAlertBody = `{
"service_key": "{{.Notification.Vars.service_key}}",
<<bunch of fields>>
}`
pdActionAck = `{
"service_key": "{{.Notification.Vars.service_key}}",
<<bunch of fields>>
}`
pdActionClose = `{
"service_key": "{{.Notification.Vars.service_key}}",
<<bunch of fields>>
}`
pdUnknownBody = `{
"service_key": "{{.Notification.Vars.service_key}}",
<<bunch of fields>>
}`
}
macro common_pagerduty_post_notification {
post = <<post address>>
contentType = application/json
bodyTemplate = pdAlertBody
runOnActions = Ack,Close
actionBodyAck = pdActionAck
actionBodyClose = pdActionClose
unknownBody = pdUnknownBody
}
template system3_template {
body = `body`
subject = `subject`
inherit = common_templates
}
notification team3_pagerduty {
$service_key = 9012 # pd service_key for team3
macro = common_pagerduty_post_notification
}
alert system1_alert {
template = system1_template
crit = <<some conditions>>
critNotification = team1_pagerduty
}
template system2_template {
body = `body`
subject = `subject`
inherit = common_templates
}
notification team2_pagerduty {
$service_key = 5678 # pd service_key for team2
macro = common_pagerduty_post_notification
}
alert system2_alert {
template = system2_template
crit = <<some conditions>>
critNotification = team2_pagerduty
}
template system3_template {
body = `body`
subject = `subject`
inherit = common_templates
}
notification team3_pagerduty {
$service_key = 9012 # pd service_key for team1
macro = common_pagerduty_post_notification
}
alert system3_alert {
template = system3_template
crit = <<some conditions>>
critNotification = team3_pagerduty
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment