Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ability to automatically close incident in PagerDuty #486

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
9 changes: 8 additions & 1 deletion senders/pagerduty/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func (sender *Sender) SendEvents(events moira.NotificationEvents, contact moira.
if err != nil {
return fmt.Errorf("failed to post the event to the pagerduty contact %s : %s. ", contact.Value, err)
}

return nil
}

Expand Down Expand Up @@ -61,10 +62,16 @@ func (sender *Sender) buildEvent(events moira.NotificationEvents, contact moira.
Details: details,
}

lAction := "trigger"
if events.GetSubjectState() == moira.StateOK {
lAction = "resolve"
}

event := pagerduty.V2Event{
RoutingKey: contact.Value,
Action: "trigger",
Action: lAction,
Payload: payload,
DedupKey: trigger.ID,
}

if len(plot) > 0 && sender.imageStoreConfigured {
Expand Down