mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 09:42:13 +08:00
Remove legacy alerting docs (#84190)
This commit is contained in:
@ -473,45 +473,6 @@ Content-Type: application/json
|
||||
|
||||
```http
|
||||
POST /api/admin/encryption/rotate-data-keys HTTP/1.1
|
||||
|
||||
Reloads the LDAP configuration.
|
||||
|
||||
Only works with Basic Authentication (username and password). See [introduction](http://docs.grafana.org/http_api/admin/#admin-api) for an explanation.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/admin/ldap/reload HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Rotate data encryption keys
|
||||
|
||||
`POST /api/admin/encryption/rotate-data-keys`
|
||||
|
||||
[Rotates]({{< relref "../../setup-grafana/configure-security/configure-database-encryption/#rotate-data-keys" >}}) data encryption keys.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/admin/encryption/rotate-data-keys HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 204
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
@ -1,184 +0,0 @@
|
||||
---
|
||||
aliases:
|
||||
- ../../http_api/alerting/
|
||||
canonical: /docs/grafana/latest/developers/http_api/alerting/
|
||||
description: Grafana Alerts HTTP API
|
||||
keywords:
|
||||
- grafana
|
||||
- http
|
||||
- documentation
|
||||
- api
|
||||
- alerting
|
||||
- alerts
|
||||
labels:
|
||||
products:
|
||||
- enterprise
|
||||
- oss
|
||||
title: Legacy Alerting API
|
||||
---
|
||||
|
||||
# Legacy Alerting API
|
||||
|
||||
{{% admonition type="note" %}}
|
||||
Starting with v9.0, the Legacy Alerting HTTP API is deprecated. It will be removed in a future release.
|
||||
{{% /admonition %}}
|
||||
|
||||
This topic is relevant for the [legacy dashboard alerts](/docs/grafana/v8.5/alerting/old-alerting/) only.
|
||||
|
||||
If you are using Grafana Alerting, refer to [Alerting provisioning API]({{< relref "./alerting_provisioning" >}})
|
||||
|
||||
You can find Grafana Alerting API specification details [here](https://editor.swagger.io/?url=https://raw.githubusercontent.com/grafana/grafana/main/pkg/services/ngalert/api/tooling/post.json). Also, refer to [Grafana Alerting alerts documentation][] for details on how to create and manage new alerts.
|
||||
|
||||
You can use the Alerting API to get information about legacy dashboard alerts and their states but this API cannot be used to modify the alert.
|
||||
To create new alerts or modify them you need to update the dashboard JSON that contains the alerts.
|
||||
|
||||
## Get alerts
|
||||
|
||||
`GET /api/alerts/`
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/alerts HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
Querystring Parameters:
|
||||
|
||||
These parameters are used as querystring parameters. For example:
|
||||
|
||||
`/api/alerts?dashboardId=1`
|
||||
|
||||
- **dashboardId** – Limit response to alerts in specified dashboard(s). You can specify multiple dashboards, e.g. dashboardId=23&dashboardId=35.
|
||||
- **panelId** – Limit response to alert for a specified panel on a dashboard.
|
||||
- **query** - Limit response to alerts having a name like this value.
|
||||
- **state** - Return alerts with one or more of the following alert states: `ALL`,`no_data`, `paused`, `alerting`, `ok`, `pending`. To specify multiple states use the following format: `?state=paused&state=alerting`
|
||||
- **limit** - Limit response to _X_ number of alerts.
|
||||
- **folderId** – Limit response to alerts of dashboards in specified folder(s). You can specify multiple folders, e.g. folderId=23&folderId=35.
|
||||
- **dashboardQuery** - Limit response to alerts having a dashboard name like this value.
|
||||
- **dashboardTag** - Limit response to alerts of dashboards with specified tags. To do an "AND" filtering with multiple tags, specify the tags parameter multiple times e.g. dashboardTag=tag1&dashboardTag=tag2.
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Get alert by id
|
||||
|
||||
`GET /api/alerts/:id`
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/alerts/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
**Important Note**:
|
||||
"evalMatches" data is cached in the db when and only when the state of the alert changes
|
||||
(e.g. transitioning from "ok" to "alerting" state).
|
||||
|
||||
If data from one server triggers the alert first and, before that server is seen leaving alerting state,
|
||||
a second server also enters a state that would trigger the alert, the second server will not be visible in "evalMatches" data.
|
||||
|
||||
## Pause alert by id
|
||||
|
||||
`POST /api/alerts/:id/pause`
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/alerts/1/pause HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
```
|
||||
|
||||
The :id query parameter is the id of the alert to be paused or unpaused.
|
||||
|
||||
JSON Body Schema:
|
||||
|
||||
- **paused** – Can be `true` or `false`. True to pause an alert. False to unpause an alert.
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Pause all alerts
|
||||
|
||||
See [Admin API][].
|
||||
|
||||
{{% docs/reference %}}
|
||||
[Admin API]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/developers/http_api/admin#pause-all-alerts"
|
||||
[Admin API]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/developers/http_api/admin#pause-all-alerts"
|
||||
|
||||
[Grafana Alerting alerts documentation]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/alerting"
|
||||
[Grafana Alerting alerts documentation]: "/docs/grafana-cloud/ -> /docs/grafana/<GRAFANA VERSION>/alerting"
|
||||
{{% /docs/reference %}}
|
||||
## Pause alert by id
|
||||
|
||||
`POST /api/alerts/:id/pause`
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/alerts/1/pause HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
{
|
||||
"paused": true
|
||||
}
|
||||
```
|
||||
|
||||
The :id query parameter is the id of the alert to be paused or unpaused.
|
||||
|
||||
JSON Body Schema:
|
||||
|
||||
- **paused** – Can be `true` or `false`. True to pause an alert. False to unpause an alert.
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"alertId": 1,
|
||||
"state": "Paused",
|
||||
"message": "alert paused"
|
||||
}
|
||||
```
|
||||
|
||||
## Pause all alerts
|
||||
|
||||
See [Admin API][].
|
||||
|
||||
{{% docs/reference %}}
|
||||
[Admin API]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/developers/http_api/admin#pause-all-alerts"
|
||||
[Admin API]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/developers/http_api/admin#pause-all-alerts"
|
||||
|
||||
[Grafana Alerting alerts documentation]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/alerting"
|
||||
[Grafana Alerting alerts documentation]: "/docs/grafana-cloud/ -> /docs/grafana/<GRAFANA VERSION>/alerting"
|
||||
{{% /docs/reference %}}
|
@ -1,424 +0,0 @@
|
||||
---
|
||||
aliases:
|
||||
- ../../http_api/alerting_notification_channels/
|
||||
canonical: /docs/grafana/latest/developers/http_api/alerting_notification_channels/
|
||||
description: Grafana Alerting Notification Channel HTTP API
|
||||
keywords:
|
||||
- grafana
|
||||
- http
|
||||
- documentation
|
||||
- api
|
||||
- alerting
|
||||
- alerts
|
||||
- notifications
|
||||
labels:
|
||||
products:
|
||||
- enterprise
|
||||
- oss
|
||||
title: Legacy Alerting Notification Channels API
|
||||
---
|
||||
|
||||
# Legacy Alerting Notification Channels API
|
||||
|
||||
{{% admonition type="note" %}}
|
||||
Starting with v9.0, the Legacy Alerting Notification Channels API is deprecated. It will be removed in a future release.
|
||||
{{% /admonition %}}
|
||||
|
||||
This page documents the Alerting Notification Channels API.
|
||||
|
||||
## Identifier (id) vs unique identifier (uid)
|
||||
|
||||
The identifier (id) of a notification channel is an auto-incrementing numeric value and is only unique per Grafana install.
|
||||
|
||||
The unique identifier (uid) of a notification channel can be used for uniquely identify a notification channel between
|
||||
multiple Grafana installs. It's automatically generated if not provided when creating a notification channel. The uid
|
||||
allows having consistent URLs for accessing notification channels and when syncing notification channels between multiple
|
||||
Grafana installations, refer to [alert notification channel provisioning]({{< relref "/docs/grafana/latest/administration/provisioning#alert-notification-channels" >}}).
|
||||
|
||||
The uid can have a maximum length of 40 characters.
|
||||
|
||||
## Get all notification channels
|
||||
|
||||
Returns all notification channels that the authenticated user has permission to view.
|
||||
|
||||
`GET /api/alert-notifications`
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
GET /api/alert-notifications HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Get all notification channels (lookup)
|
||||
|
||||
Returns all notification channels, but with less detailed information. Accessible by any authenticated user and is mainly used by providing alert notification channels in Grafana UI when configuring alert rule.
|
||||
|
||||
`GET /api/alert-notifications/lookup`
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
GET /api/alert-notifications/lookup HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Get notification channel by uid
|
||||
|
||||
`GET /api/alert-notifications/uid/:uid`
|
||||
|
||||
Returns the notification channel given the notification channel uid.
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
GET /api/alert-notifications/uid/team-a-email-notifier HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Get notification channel by id
|
||||
|
||||
`GET /api/alert-notifications/:id`
|
||||
|
||||
Returns the notification channel given the notification channel id.
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
GET /api/alert-notifications/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Create notification channel
|
||||
|
||||
You can find the full list of [supported notifiers](/docs/grafana/v8.5/alerting/old-alerting/notifications/) on the alert notifiers page.
|
||||
|
||||
`POST /api/alert-notifications`
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
POST /api/alert-notifications HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Update notification channel by uid
|
||||
|
||||
`PUT /api/alert-notifications/uid/:uid`
|
||||
|
||||
Updates an existing notification channel identified by uid.
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
PUT /api/alert-notifications/uid/cIBgcSjkk HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Update notification channel by id
|
||||
|
||||
`PUT /api/alert-notifications/:id`
|
||||
|
||||
Updates an existing notification channel identified by id.
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
PUT /api/alert-notifications/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Delete alert notification by uid
|
||||
|
||||
`DELETE /api/alert-notifications/uid/:uid`
|
||||
|
||||
Deletes an existing notification channel identified by uid.
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
DELETE /api/alert-notifications/uid/team-a-email-notifier HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Delete alert notification by id
|
||||
|
||||
`DELETE /api/alert-notifications/:id`
|
||||
|
||||
Deletes an existing notification channel identified by id.
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
DELETE /api/alert-notifications/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
|
||||
## Test notification channel
|
||||
|
||||
Sends a test notification message for the given notification channel type and settings.
|
||||
You can find the full list of [supported notifiers](/alerting/notifications/#all-supported-notifier) at the alert notifiers page.
|
||||
|
||||
`POST /api/alert-notifications/test`
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
POST /api/alert-notifications/test HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
```
|
||||
{
|
||||
"id": 1,
|
||||
"uid": "new-alert-notification",
|
||||
"name": "new alert notification",
|
||||
"type": "email",
|
||||
"isDefault": false,
|
||||
"sendReminder": true,
|
||||
"frequency": "15m",
|
||||
"settings": {
|
||||
"addresses": "dev@grafana.com"
|
||||
},
|
||||
"created": "2017-01-01 12:34",
|
||||
"updated": "2017-01-01 12:34"
|
||||
}
|
||||
```
|
||||
|
||||
## Update notification channel by id
|
||||
|
||||
`PUT /api/alert-notifications/:id`
|
||||
|
||||
Updates an existing notification channel identified by id.
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
PUT /api/alert-notifications/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"uid": "new-alert-notification", // optional
|
||||
"name": "new alert notification", //Required
|
||||
"type": "email", //Required
|
||||
"isDefault": false,
|
||||
"sendReminder": true,
|
||||
"frequency": "15m",
|
||||
"settings": {
|
||||
"addresses": "dev@grafana.com"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"id": 1,
|
||||
"uid": "new-alert-notification",
|
||||
"name": "new alert notification",
|
||||
"type": "email",
|
||||
"isDefault": false,
|
||||
"sendReminder": true,
|
||||
"frequency": "15m",
|
||||
"settings": {
|
||||
"addresses": "dev@grafana.com"
|
||||
},
|
||||
"created": "2017-01-01 12:34",
|
||||
"updated": "2017-01-01 12:34"
|
||||
}
|
||||
```
|
||||
|
||||
## Delete alert notification by uid
|
||||
|
||||
`DELETE /api/alert-notifications/uid/:uid`
|
||||
|
||||
Deletes an existing notification channel identified by uid.
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
DELETE /api/alert-notifications/uid/team-a-email-notifier HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"message": "Notification deleted"
|
||||
}
|
||||
```
|
||||
|
||||
## Delete alert notification by id
|
||||
|
||||
`DELETE /api/alert-notifications/:id`
|
||||
|
||||
Deletes an existing notification channel identified by id.
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
DELETE /api/alert-notifications/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"message": "Notification deleted"
|
||||
}
|
||||
```
|
||||
|
||||
## Test notification channel
|
||||
|
||||
Sends a test notification message for the given notification channel type and settings.
|
||||
You can find the full list of [supported notifiers](/alerting/notifications/#all-supported-notifier) at the alert notifiers page.
|
||||
|
||||
`POST /api/alert-notifications/test`
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
POST /api/alert-notifications/test HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
{
|
||||
"type": "email",
|
||||
"settings": {
|
||||
"addresses": "dev@grafana.com"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"message": "Test notification sent"
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user