Skip to content

Instantly share code, notes, and snippets.

@KozzyKoder
Created June 29, 2018 14:07
Show Gist options
  • Save KozzyKoder/c88bbfb6c70758f28790c1b39da47eb8 to your computer and use it in GitHub Desktop.
Save KozzyKoder/c88bbfb6c70758f28790c1b39da47eb8 to your computer and use it in GitHub Desktop.
$pd_service_key_for_team1 = 1234
$pd_service_key_for_team2 = 5678
$pd_service_key_for_team3 = 9012
template common_notifications {
pdAlertBody = `{
"service_key": "{{.Get "service_key" }}",
<<bunch of fields>>
}`
pdAlertActionAck = `{
"service_key": "{{.Get "service_key" }}",
<<bunch of fields>>
}`
pdAlertActionClose = `{
"service_key": "{{.Get "service_key" }}",
<<bunch of fields>>
}`
pdAlertUnknownBody = `{
"service_key": "{{.Get "service_key" }}",
<<bunch of fields>>
}`
}
template system1_template {
body = `body`
subject = `subject`
inherit = common_notifications
pdSystem1AlertBody = `{{ .Set "service_key" (V "$pd_service_key_for_team1") }}{{ template "common_notifications" . }}`
pdSystem1ActionAck = `{{ .Set "service_key" (V "$pd_service_key_for_team1") }}{{ template "common_notifications" . }}`
pdSystem1ActionClose = `{{ .Set "service_key" (V "$pd_service_key_for_team1") }}{{ template "common_notifications" . }}`
pdSystem1UnknownBody = `{{ .Set "service_key" (V "$pd_service_key_for_team1") }}{{ template "common_notifications" . }}`
}
notification team1_pagerduty {
post = <<post address>>
contentType = application/json
bodyTemplate = pdSystem1AlertBody
runOnActions = Ack,Close
actionBodyAck = pdSystem1ActionAck
actionBodyClose = pdSystem1ActionClose
unknownBody = pdSystem1UnknownBody
}
alert system1_alert {
template = system1_template
crit = <<some conditions>>
critNotification = team1_pagerduty
}
template system2_template {
body = `body`
subject = `subject`
inherit = common_notifications
pdSystem2AlertBody = `{{ .Set "service_key" (V "$pd_service_key_for_team2") }}{{ template "common_notifications" . }}`
pdSystem2ActionAck = `{{ .Set "service_key" (V "$pd_service_key_for_team2") }}{{ template "common_notifications" . }}`
pdSystem2ActionClose = `{{ .Set "service_key" (V "$pd_service_key_for_team2") }}{{ template "common_notifications" . }}`
pdSystem2UnknownBody = `{{ .Set "service_key" (V "$pd_service_key_for_team2") }}{{ template "common_notifications" . }}`
}
notification team2_pagerduty {
post = <<post address>>
contentType = application/json
bodyTemplate = pdSystem2AlertBody
runOnActions = Ack,Close
actionBodyAck = pdSystem2ActionAck
actionBodyClose = pdSystem2ActionClose
unknownBody = pdSystem2UnknownBody
}
alert system2_alert {
template = system2_template
crit = <<some conditions>>
critNotification = team2_pagerduty
}
template system3_template {
body = `body`
subject = `subject`
inherit = common_notifications
pdSystem3AlertBody = `{{ .Set "service_key" (V "$pd_service_key_for_team3") }}{{ template "common_notifications" . }}`
pdSystem3ActionAck = `{{ .Set "service_key" (V "$pd_service_key_for_team3") }}{{ template "common_notifications" . }}`
pdSystem3ActionClose = `{{ .Set "service_key" (V "$pd_service_key_for_team3") }}{{ template "common_notifications" . }}`
pdSystem3UnknownBody = `{{ .Set "service_key" (V "$pd_service_key_for_team3") }}{{ template "common_notifications" . }}`
}
notification team3_pagerduty {
post = <<post address>>
contentType = application/json
bodyTemplate = pdSystem3AlertBody
runOnActions = Ack,Close
actionBodyAck = pdSystem3ActionAck
actionBodyClose = pdSystem3ActionClose
unknownBody = pdSystem3UnknownBody
}
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