Alerts and Notification Channels APIs
List of APIs to manage alerts and notification channels
Notification Channel APIs
Body
objectOptionalExample:
{"manager":"grafana","name":"functional-metrics-email","type":"email","config":{"recipientAddresses":"[email protected];[email protected]","subject":"Obsrv Prod Alert"}}Responses
200
Successful response
application/json
post
/alerts/v1/notifications/create200
Successful response
No content
Path parameters
alert_idstringRequired
Unique identifier for the alert
Body
objectOptionalExample:
{"name":"updated name"}Responses
200
Successful response
application/json
patch
/alerts/v1/notifications/update/{alert_id}200
Successful response
No content
Body
objectOptionalExample:
{"message":"Testing Email integration. If you can read this, it's working!","payload":{"error":{"selectChannel":true,"configureChannel":true},"manager":"grafana","name":"udhw","type":"email","config":{"recipientAddresses":"[email protected]"}}}Responses
200
Successful response
application/json
post
/alerts/v1/notifications/test200
Successful response
No content
Alerts APIs
Header parameters
AcceptstringOptionalExample:
application/json, text/plain, */*Accept-LanguagestringOptionalExample:
en-GB,enCache-ControlstringOptionalExample:
no-storeConnectionstringOptionalExample:
keep-aliveContent-TypestringOptionalExample:
application/jsonCookiestringOptionalExample:
connect.sid=s%3A5w5I87Tior-cvNu-SijqRFKGxy_b-WIP.lDKfWAJZbxW0kMaUqj%2B0Ivu%2FvNXXL8S796Fa7%2BNyM9Q; grafana_session=4eb514f6fef4ad6884e47e50254af650; grafana_session_expiry=1687239735OriginstringOptionalExample:
http://localhost:3001PragmastringOptionalExample:
no-storeRefererstringOptionalExample:
http://localhost:3001/alertRules/addSec-Fetch-DeststringOptionalExample:
emptySec-Fetch-ModestringOptionalExample:
corsSec-Fetch-SitestringOptionalExample:
same-originSec-GPCintegerOptionalExample:
1User-AgentstringOptionalExample:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36Body
stringOptionalExample:
"{\n \"name\": \"Total Api Calls1\",\n \"manager\":\"grafana\",\n \"description\": \"This alert is set up to notify you when the CPU usage on a host reaches a Low level.\",\n \"expression\": \"(node_total_api_calls) > 20\",\n \"category\": \"Infra\",\n \"severity\":\"warning\",\n \"frequency\": \"1m\",\n \"interval\": \"1m\",\n \"labels\": {\n \"component\": \"api\",\n \"notificationChannel\": \"slack\"\n },\n \"annotations\":{\n \"summary\":\"Host Low CPU usage\"\n },\n \"metadata\": {\n \"query\": [\n {\n \"refId\": \"A\",\n \"datasourceUid\": \"$datasourceUid\",\n \"queryType\": \"\",\n \"relativeTimeRange\": {\n \"from\": 600,\n \"to\": 0\n },\n \"model\": {\n \"refId\": \"A\",\n \"hide\": false,\n \"editorMode\": \"code\",\n \"expr\": \"node_total_api_calls\",\n \"legendFormat\": \"__auto\",\n \"range\": true\n }\n },\n {\n \"refId\": \"B\",\n \"datasourceUid\": \"__expr__\",\n \"queryType\": \"\",\n \"model\": {\n \"refId\": \"B\",\n \"hide\": false,\n \"type\": \"reduce\",\n \"datasource\": {\n \"uid\": \"__expr__\",\n \"type\": \"__expr__\"\n },\n \"conditions\": [\n {\n \"type\": \"query\",\n \"evaluator\": {\n \"params\": [],\n \"type\": \"gt\"\n },\n \"operator\": {\n \"type\": \"and\"\n },\n \"query\": {\n \"params\": [\n \"B\"\n ]\n },\n \"reducer\": {\n \"params\": [],\n \"type\": \"last\"\n }\n }\n ],\n \"reducer\": \"last\",\n \"expression\": \"A\"\n },\n \"relativeTimeRange\": {\n \"from\": 600,\n \"to\": 0\n }\n },\n {\n \"refId\": \"C\",\n \"datasourceUid\": \"__expr__\",\n \"queryType\": \"\",\n \"model\": {\n \"refId\": \"C\",\n \"hide\": false,\n \"type\": \"threshold\",\n \"datasource\": {\n \"uid\": \"__expr__\",\n \"type\": \"__expr__\"\n },\n \"conditions\": [\n {\n \"type\": \"query\",\n \"evaluator\": {\n \"params\": [\n 20\n ],\n \"type\": \"gt\"\n },\n \"operator\": {\n \"type\": \"and\"\n },\n \"query\": {\n \"params\": [\n \"C\"\n ]\n },\n \"reducer\": {\n \"params\": [],\n \"type\": \"last\"\n }\n }\n ],\n \"expression\": \"B\"\n },\n \"relativeTimeRange\": {\n \"from\": 600,\n \"to\": 0\n }\n }\n ]\n }\n}"Responses
200
Successful response
application/json
post
/alerts/v1/create200
Successful response
No content
This URL will provide access to users to edit any properties in the Alert rule and save the changes.
Path parameters
alert_idstringRequired
Unique identifier for the alert
Body
objectOptionalExample:
{"description":"This alert rule is designed to promptly notify you when one or more servers in your infrastructure become unresponsive or inaccessible.","labels":{"severity":"warning"}}Responses
200
Successful response
application/json
patch
/alerts/v1/update/{alert_id}200
Successful response
No content
This URLwill provided access to user to delete any custom rule.
Path parameters
alert_idstringRequired
Unique identifier for the alert
Responses
200
Successful response
application/json
delete
/alerts/v1/delete/{alert_id}200
Successful response
No content
Alerts Silience APIs
Body
objectOptionalExample:
{"startDate":"2024-01-11T07:56:23Z","endDate":"2024-01-11T08:56:23Z","alertId":"c7464d32-1d8d-4eaf-9b23-1313a3ff8149","manager":"grafana"}Responses
200
Successful response
application/json
post
/alerts/v1/silence/create200
Successful response
No content
