feat(alerting): add more fields to webhook

This commit is contained in:
bergquist 2016-08-22 15:11:27 +02:00
parent 1ff21b3ee8
commit 3b8bba3e9f

View File

@ -47,8 +47,19 @@ func (this *WebhookNotifier) Notify(context *alerting.EvalContext) {
bodyJSON.Set("title", context.GetNotificationTitle())
bodyJSON.Set("ruleId", context.Rule.Id)
bodyJSON.Set("ruleName", context.Rule.Name)
bodyJSON.Set("firing", context.Firing)
bodyJSON.Set("state", context.Rule.State)
bodyJSON.Set("severity", context.Rule.Severity)
bodyJSON.Set("evalMatches", context.EvalMatches)
ruleUrl, err := context.GetRuleUrl()
if err == nil {
bodyJSON.Set("rule_url", ruleUrl)
}
imageUrl, err := context.GetImageUrl()
if err == nil {
bodyJSON.Set("image_url", imageUrl)
}
body, _ := bodyJSON.MarshalJSON()