mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* [Alerting]: Require login for alerting API routes * Fix example requests * [Alerting]: Add /api prefix to all routes (#32716)
101 lines
2.4 KiB
HTTP
101 lines
2.4 KiB
HTTP
@alertManagerDatasourceID = 36
|
|
|
|
###
|
|
# create AM configuration
|
|
POST http://localhost:3000/api/alertmanager/{{alertManagerDatasourceID}}/config/api/v1/alerts
|
|
content-type: application/json
|
|
|
|
{
|
|
"template_files": {},
|
|
"alertmanager_config": {
|
|
"global": {
|
|
"smtp_smarthost": "localhost:25",
|
|
"smtp_from": "youraddress@example.org",
|
|
},
|
|
"receivers": [
|
|
{
|
|
"name": "example-email",
|
|
"email_configs": {
|
|
"to": "youraddress@example.org"
|
|
}
|
|
}
|
|
],
|
|
"route": {
|
|
"receiver": "example-email",
|
|
"routes": [],
|
|
"group_wait": "1s",
|
|
"group_interval": "1s",
|
|
"repeat_interval": "1s"
|
|
},
|
|
"template": []
|
|
}
|
|
}
|
|
|
|
###
|
|
# get latest AM configuration
|
|
GET http://localhost:3000/api/alertmanager/{{alertManagerDatasourceID}}/config/api/v1/alerts
|
|
content-type: application/json
|
|
|
|
###
|
|
# delete AM configuration
|
|
DELETE http://localhost:3000/api/alertmanager/{{alertManagerDatasourceID}}/config/api/v1/alerts
|
|
|
|
###
|
|
# create AM alerts
|
|
POST http://localhost:3000/api/alertmanager/{{alertManagerDatasourceID}}/api/v2/alerts
|
|
content-type: application/json
|
|
|
|
###
|
|
# get silences - no silences
|
|
GET http://localhost:3000/api/alertmanager/{{alertManagerDatasourceID}}/api/v2/silences?Filter=foo="bar"&Filter=bar="foo"
|
|
|
|
###
|
|
# create silence
|
|
POST http://localhost:3000/api/alertmanager/{{alertManagerDatasourceID}}/api/v2/silences
|
|
content-type: application/json
|
|
|
|
{
|
|
"comment": "string",
|
|
"createdBy": "string",
|
|
"endsAt": "2023-03-31T14:17:04.419Z",
|
|
"matchers": [
|
|
{
|
|
"isRegex": true,
|
|
"name": "string",
|
|
"value": "string"
|
|
}
|
|
],
|
|
"startsAt": "2021-03-31T13:17:04.419Z"
|
|
}
|
|
|
|
###
|
|
# update silence - does not exist
|
|
POST http://localhost:3000/api/alertmanager/{{alertManagerDatasourceID}}/api/v2/silences
|
|
content-type: application/json
|
|
|
|
{
|
|
"id": "something",
|
|
"comment": "string",
|
|
"createdBy": "string",
|
|
"endsAt": "2023-03-31T14:17:04.419Z",
|
|
"matchers": [
|
|
{
|
|
"isRegex": true,
|
|
"name": "string",
|
|
"value": "string"
|
|
}
|
|
],
|
|
"startsAt": "2021-03-31T13:17:04.419Z"
|
|
}
|
|
|
|
###
|
|
# get silences
|
|
GET http://localhost:3000/api/alertmanager/{{alertManagerDatasourceID}}/api/v2/silences
|
|
|
|
###
|
|
# get silence
|
|
GET http://localhost:3000/api/alertmanager/{{alertManagerDatasourceID}}/api/v2/silence/unknown
|
|
|
|
###
|
|
# delete silence
|
|
DELETE http://localhost:3000/api/alertmanager/{{alertManagerDatasourceID}}/api/v2/silence/unknown |