mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 16:15:42 -06:00
Alerting: Add more information to webhook notifications (#20420)
Adds the orgId, dashboardId and panelId of the Webhook alert notifier.
This commit is contained in:
parent
2e60752258
commit
5b3ff90377
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user