Commit 5b3ff903 by michael-az Committed by Marcus Efraimsson

Alerting: Add more information to webhook notifications (#20420)

Adds the orgId, dashboardId and panelId of the Webhook alert notifier.
parent 2e607522
......@@ -111,22 +111,27 @@ Example json body:
```json
{
"title": "My alert",
"ruleId": 1,
"ruleName": "Load peaking!",
"ruleUrl": "http://url.to.grafana/db/dashboard/my_dashboard?panelId=2",
"state": "alerting",
"imageUrl": "http://s3.image.url",
"message": "Load is peaking. Make sure the traffic is real and spin up more webfronts",
"evalMatches": [
"dashboardId":1,
"evalMatches":[
{
"metric": "requests",
"tags": {},
"value": 122
"value":1,
"metric":"Count",
"tags":{}
}
]
}
```
],
"imageUrl":"https://grafana.com/assets/img/blog/mixed_styles.png",
"message":"Notification Message",
"orgId":1,
"panelId":2,
"ruleId":1,
"ruleName":"Panel Title alert",
"ruleUrl":"http://localhost:3000/d/hZ7BuVbWz/test-dashboard?fullscreen\u0026edit\u0026tab=alert\u0026panelId=2\u0026orgId=1",
"state":"alerting",
"tags":{
"tag name":"tag value"
},
"title":"[Alerting] Panel Title alert"
}```
- **state** - The possible values for alert state are: `ok`, `paused`, `alerting`, `pending`, `no_data`.
......
......@@ -80,6 +80,9 @@ func (wn *WebhookNotifier) Notify(evalContext *alerting.EvalContext) error {
bodyJSON.Set("ruleName", evalContext.Rule.Name)
bodyJSON.Set("state", evalContext.Rule.State)
bodyJSON.Set("evalMatches", evalContext.EvalMatches)
bodyJSON.Set("orgId", evalContext.Rule.OrgID)
bodyJSON.Set("dashboardId", evalContext.Rule.DashboardID)
bodyJSON.Set("panelId", evalContext.Rule.PanelID)
tags := make(map[string]string)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment