You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Alerting is still in very early development. Please be aware.
10
10
11
-
The roadmap for alerting is described in [issue #2209](https://github.com/grafana/grafana/issues/2209#issuecomment-210077445) and the current state can be found at this page.
11
+
The roadmap for alerting in Grafana have been changing rapidly during last 2-3 months. So make sure you follow the disucssion in the [alerting issue](https://github.com/grafana/grafana/issues/2209).
12
12
13
13
## Introduction
14
14
15
-
So far Grafana does only support saving alering rules but not execute it. This means that you have to export them from grafana using the api and import them into your monitoring tool of choice. The current defintion of an alert rule looks like this:
15
+
> Alerting is turned off by default and have to be enabled in the config file.
16
16
17
-
```go
18
-
typeAlertRulestruct {
19
-
Idint64`json:"id"`
20
-
OrgIdint64`json:"-"`
21
-
DashboardIdint64`json:"dashboardId"`
22
-
PanelIdint64`json:"panelId"`
23
-
Querystring`json:"query"`
24
-
QueryRefIdstring`json:"queryRefId"`
25
-
WarnLevelint64`json:"warnLevel"`
26
-
CritLevelint64`json:"critLevel"`
27
-
WarnOperatorstring`json:"warnOperator"`
28
-
CritOperatorstring`json:"critOperator"`
29
-
Intervalstring`json:"interval"`
30
-
Titlestring`json:"title"`
31
-
Descriptionstring`json:"description"`
32
-
QueryRangestring`json:"queryRange"`
33
-
Aggregatorstring`json:"aggregator"`
34
-
Statestring`json:"state"`
35
-
}
36
-
```
17
+
Grafana lets you define alert rules based on metrics queries on dashboards. Every alert is connected to a panel and when ever the query for the panel is updated the alerting rule is also updated.
18
+
So far only the graph panel supports alerting. To enable alerting for a panel go to the alerting tab and press 'Create alert' button.
37
19
38
-
Most of these properties might require some extra explaination.
20
+
## Alert status page
39
21
40
-
Query: json representation of the query used by grafana. Differes depending on datasource.
41
-
QueryRange: The time range for which the query should look back.
42
-
Aggregator: How the result should be reduced into a single value. ex avg, sum, min, max
43
-
State: Current state of the alert OK, WARN, CRITICAL, ACKNOWLEGED.
22
+
You can overview all your current alerts on the alert stats page at /alerting
44
23
45
-
You can configure these settings in the Alerting tab on graph panels in edit mode. When the dashboard is saved the alert is created or updated based on the dashboard. If you wish to delete an alert you simply set the query to '- select query -' in the alerting tab and save the dashboard.
24
+
## Alert notifications
46
25
47
-
## Api
26
+
When an alert is triggered it goes to the notification handler who takes care of sending emails or push data as webhooks.
27
+
The alert notifications can be configured on /alerting/notifications
48
28
49
-
### Alert rules
50
-
51
-
```url
52
-
GET /api/alerts/rules
53
-
```
54
-
55
-
```http
56
-
state //array of strings *optional*
57
-
dashboardId //int *optional*
58
-
panelId //int *optional*
59
-
60
-
Result
61
-
[]AlertRule
62
-
```
63
-
64
-
```http
65
-
GET /api/alerts/rules/:alertId
66
-
67
-
Result AlertRule
68
-
```
69
-
70
-
### Alert state
71
-
72
-
```http
73
-
GET /api/alerts/rulres/:alertId/states
74
-
75
-
Result
76
-
[
77
-
{
78
-
alertId: int,
79
-
newState: OK, WARN, CRITICAL, ACKNOWLEGED,
80
-
created: timestamp,
81
-
info: description of what might have caused the changed alert state
82
-
}
83
-
]
84
-
```
85
-
86
-
```http
87
-
PUT /api/alerts/rulres/:alertId/state
88
-
Request
89
-
{
90
-
alertId: alertid,
91
-
newState: OK, WARN, CRITICAL, ACKNOWLEGED,
92
-
info: description of what might have caused the changed alert state
0 commit comments