mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): add basic body for webhooks
This commit is contained in:
parent
6705efef6f
commit
3c4d2b8ca1
@ -73,11 +73,19 @@ type WebhookNotifier struct {
|
|||||||
|
|
||||||
func (this *WebhookNotifier) Dispatch(alertResult *AlertResult) {
|
func (this *WebhookNotifier) Dispatch(alertResult *AlertResult) {
|
||||||
this.log.Info("Sending webhook")
|
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{
|
cmd := &m.SendWebhook{
|
||||||
Url: this.Url,
|
Url: this.Url,
|
||||||
User: this.User,
|
User: this.User,
|
||||||
Password: this.Password,
|
Password: this.Password,
|
||||||
Body: alertResult.Description,
|
Body: string(body),
|
||||||
}
|
}
|
||||||
|
|
||||||
bus.Dispatch(cmd)
|
bus.Dispatch(cmd)
|
||||||
|
Loading…
Reference in New Issue
Block a user