POST /v2/alerts/prom/rules/
Request format:
{
"rules": [
{
"alert": "Test Alert",
"expr": "up == 1",
"for": "1m",
"labels": <key-value>,
"annotations": <key-value>
}
]
}
Parameters:
Curl example:
curl --location --request POST 'https://YOUR-API-KEY@api.hostedgraphite.com/v2/alerts/prom/rules/' \
--header 'Content-Type: application/json' \
--data-raw '{
"rules": [
{
"alert": "Test Alert",
"expr": "up == 1",
"for": "10m",
"labels": {
"service": "prom"
},
"annotations": {
"description": "instance: {{ $labels.instance }}"
}
}
]
}'
Status Codes:
POST /v2/alerts/prom/config/rules/
Curl example:
curl -X POST 'https://YOUR-API-KEY@api.hostedgraphite.com/v2/alerts/prom/config/rules/' --form 'rules=@{filename including path}'
You can also see how to configure rules file by the following rules configuration link.
Status Codes:
POST /v2/alerts/prom/config/alertmanager/
Curl example:
curl -X POST 'https://YOUR-API-KEY@api.hostedgraphite.com/v2/alerts/prom/config/alertmanager/' --form 'alertmanager=@{filename including path}'
You can also see how to configure alertmanager file by the following alertmanager configuration link.
Status Codes:
GET /v2/alerts/prom/notifications/ - Returns a list of notification channels for Prometheus alerts.
Curl example:
curl -X GET "https://YOUR-API-KEY@api.hostedgraphite.com/v2/alerts/prom/notifications/"
Response format:
HTTP/1.1 200
Content-Type: application/json
[{
"destination": "email@example.com",
"type": "email",
"description": "Email me"
},
{
"destination": "https://hooks.slack.com/services/example",
"type": "slack",
"description": "Alert slack"
}]
Status Codes:
GET /v2/alerts/prom/alerts/ - Returns a list of all active alerts.
Curl example:
curl -X GET "https://YOUR-API-KEY@api.hostedgraphite.com/v2/alerts/prom/alerts/"
Response format:
HTTP/1.1 200
Content-Type: application/json
[{
"state": "Alert status",
"labels": {"<Key-value pairs of labels>"},
"annotations": {"<Key-value pairs of annotations>"},
"value": "2.98e+00",
"activeAt": "2020-07-22T11:44:49.564128025Z"
}]
Status Codes:
GET /v2/alerts/prom/rules/ - Returns list of alerting rules.
Curl example:
curl -X GET "https://YOUR-API-KEY@api.hostedgraphite.com/v2/alerts/prom/rules/"
Alert response format:
HTTP/1.1 200
Content-Type: application/json
{
"groups": [
{
"name": "example",
"rules": [
{
"alerts": ["<List of triggered alerts with this rule>"],
"name": "Name of the alert",
"labels": { "<Key-value pairs of labels>" },
"evaluationTime": 0.004250918,
"lastEvaluation": "2020-07-22T11:39:49.564325153Z",
"state": "Alert rule status 'inactive/firing'",
"health": "ok",
"duration": 0,
"query": "Alert expression",
"lastError": "",
"type": "alerting",
"annotations": {"<Key-value pairs of annotations>"}
}
],
"interval": 60,
"evaluationTime": 0.012137449,
"file": "rules.yaml",
"lastEvaluation": "2020-07-22T11:39:49.564312072Z"
}
]}
Status Codes: