docs(alerting): change api url layout

This commit is contained in:
bergquist
2016-05-11 14:08:45 +02:00
parent c76c2f30a8
commit e69658128c
2 changed files with 30 additions and 23 deletions
+28 -22
View File
@@ -6,13 +6,13 @@ page_keywords: alerting, grafana, plugins, documentation
# Alerting
> Alerting is in very early development.
> Alerting is still in very early development. Please be aware.
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.
## Introduction
So far Grafana does only support saving alering rules but not execute it. This means that any one using grafana for alerts have to extract the alerts from grafana and then import them into their own monitoring systems. The current defintion of an alert rule looks like this:
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:
``` go
type AlertRule struct {
@@ -42,14 +42,17 @@ QueryRange: The time range for which the query should look back.
Aggregator: How the result should be reduced into a single value. ex avg, sum, min, max
State: Current state of the alert OK, WARN, CRITICAL, ACKNOWLEGED.
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. (this will be improved within the UI later on).
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.
## Api
Endpoints
### Alert rules
``` url
GET /api/alerts/rules
```
``` http
GET /api/alerts/rules
state //array of strings *optional*
dashboardId //int *optional*
panelId //int *optional*
@@ -59,27 +62,13 @@ Result
```
``` http
GET /api/alerts/changes
limit //array of strings *optional*
sinceId //int *optional*
Result
[
{
id: incrementing id,
alertId: alertId,
type: CREATED/UPDATED/DELETED,
created: timestamp,
}
]
```
``` http
GET /api/alerts/rulres/:alertId
GET /api/alerts/rules/:alertId
Result AlertRule
```
### Alert state
``` http
GET /api/alerts/rulres/:alertId/states
@@ -103,3 +92,20 @@ Request
info: description of what might have caused the changed alert state
}
```
### Alert rule changes
``` http
GET /api/alerts/changes
limit //array of strings *optional*
sinceId //int *optional*
Result
[
{
id: incrementing id,
alertId: alertId,
type: CREATED/UPDATED/DELETED,
created: timestamp,
}
]
```
@@ -43,7 +43,8 @@ export class AlertTabCtrl {
convertThresholdsToAlertThresholds() {
if (this.panel.grid
&& this.panel.grid.threshold1
&& this.panel.alerting.warnLevel === undefined) {
&& this.panel.alerting.warnLevel === undefined
) {
this.panel.alerting.warnOperator = '>';
this.panel.alerting.warnLevel = this.panel.grid.threshold1;
}