feat(alerting): add more fields to webhook
This commit is contained in:
@@ -47,8 +47,19 @@ func (this *WebhookNotifier) Notify(context *alerting.EvalContext) {
|
|||||||
bodyJSON.Set("title", context.GetNotificationTitle())
|
bodyJSON.Set("title", context.GetNotificationTitle())
|
||||||
bodyJSON.Set("ruleId", context.Rule.Id)
|
bodyJSON.Set("ruleId", context.Rule.Id)
|
||||||
bodyJSON.Set("ruleName", context.Rule.Name)
|
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("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()
|
body, _ := bodyJSON.MarshalJSON()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user