From 3c4d2b8ca1b0d7ec24c3c5ed9fc0518a039b3dec Mon Sep 17 00:00:00 2001 From: bergquist Date: Thu, 16 Jun 2016 16:25:23 +0200 Subject: [PATCH] feat(alerting): add basic body for webhooks --- pkg/services/alerting/notifier.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/services/alerting/notifier.go b/pkg/services/alerting/notifier.go index 661f761b6ff..13588373bf3 100644 --- a/pkg/services/alerting/notifier.go +++ b/pkg/services/alerting/notifier.go @@ -73,11 +73,19 @@ type WebhookNotifier struct { func (this *WebhookNotifier) Dispatch(alertResult *AlertResult) { this.log.Info("Sending webhook") + + bodyJSON := simplejson.New() + bodyJSON.Set("name", alertResult.AlertJob.Rule.Name) + bodyJSON.Set("state", alertResult.State) + bodyJSON.Set("trigged", alertResult.TriggeredAlerts) + + body, _ := bodyJSON.MarshalJSON() + cmd := &m.SendWebhook{ Url: this.Url, User: this.User, Password: this.Password, - Body: alertResult.Description, + Body: string(body), } bus.Dispatch(cmd)