mirror of
https://github.com/grafana/grafana.git
synced 2025-07-28 08:42:33 +08:00

* Set every page to have defaults of 'Enterprise' and 'Open source' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration pages to have of 'Cloud', 'Enterprise', and 'Open source' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/enterprise-licensing pages to have 'Enterprise' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/organization-management pages to have 'Enterprise' and 'Open source' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/provisioning pages to have 'Enterprise' and 'Open source' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/recorded-queries pages to have labels cloud,enterprise * Set administration/roles-and-permissions/access-control pages to have labels cloud,enterprise Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/stats-and-license pages to have labels cloud,enterprise * Set alerting pages to have labels cloud,enterprise,oss * Set breaking-changes pages to have labels cloud,enterprise,oss * Set dashboards pages to have labels cloud,enterprise,oss * Set datasources pages to have labels cloud,enterprise,oss * Set explore pages to have labels cloud,enterprise,oss * Set fundamentals pages to have labels cloud,enterprise,oss * Set introduction/grafana-cloud pages to have labels cloud Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Fix introduction pages products Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set panels-visualizations pages to have labels cloud,enterprise,oss * Set release-notes pages to have labels cloud,enterprise,oss * Set search pages to have labels cloud,enterprise,oss * Set setup-grafana/configure-security/audit-grafana pages to have labels cloud,enterprise Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set setup-grafana/configure-security/configure-authentication pages to have labels cloud,enterprise,oss * Set setup-grafana/configure-security/configure-authentication/enhanced-ldap pages to have labels cloud,enterprise * Set setup-grafana/configure-security/configure-authentication/saml pages to have labels cloud,enterprise * Set setup-grafana/configure-security/configure-database-encryption/encrypt-secrets-using-hashicorp-key-vault pages to have labels cloud,enterprise * Set setup-grafana/configure-security/configure-request-security pages to have labels cloud,enterprise,oss Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set setup-grafana/configure-security/configure-team-sync pages to have labels cloud,enterprise Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set setup-grafana/configure-security/export-logs pages to have labels cloud,enterprise Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set troubleshooting pages to have labels cloud,enterprise,oss * Set whatsnew pages to have labels cloud,enterprise,oss * Apply updated labels from review Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --------- Signed-off-by: Jack Baldry <jack.baldry@grafana.com> Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
177 lines
5.0 KiB
Markdown
177 lines
5.0 KiB
Markdown
---
|
||
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]({{< relref "../../alerting" >}}) 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]({{< relref "/docs/grafana/latest/developers/http_api/admin#pause-all-alerts" >}}).
|