Alert Export APIΒΆ
Note
This feature is available with the Robusta SaaS platform and self-hosted commercial plans. It is not available in the open-source version.
Use this endpoint to export alert history data. You can filter the results based on specific criteria using query parameters such as alert_name
, account_id
, and time range.
GET https://api.robusta.dev/api/query/alertsΒΆ
Query ParametersΒΆ
Parameter |
Type |
Description |
Required |
---|---|---|---|
|
string |
The unique account identifier (found in your |
Yes |
|
string |
Start timestamp for the alert history query (in ISO 8601 format, e.g., |
Yes |
|
string |
End timestamp for the alert history query (in ISO 8601 format, e.g., |
Yes |
|
string |
The name of the alert to filter by (e.g., |
No |
Example RequestΒΆ
The following curl
command demonstrates how to export alert history data for the CrashLoopBackoff
alert:
curl --location 'https://api.robusta.dev/api/query/alerts?alert_name=CrashLoopBackoff&account_id=ACCOUNT_ID&start_ts=2024-09-02T04%3A02%3A05.032Z&end_ts=2024-09-17T05%3A02%3A05.032Z' \
--header 'Authorization: Bearer API-KEY'
In the command, make sure to replace the following placeholders:
ACCOUNT_ID
: Your account ID, which can be found in yourgenerated_values.yaml
file.API-KEY
: Your API Key for authentication. You can generate this token in the platform by navigating to Settings -> API Keys -> New API Key, and creating a key with the "Read Alerts" permission.
Request HeadersΒΆ
Header |
Description |
---|---|
|
Bearer token for authentication (e.g., |
Response FormatΒΆ
The API will return a list of alerts in JSON format. Each alert object contains detailed information about the alert, including the name, priority, source, and related resource information.
Example ResponseΒΆ
[
{
"alert_name": "CrashLoopBackoff",
"title": "Crashing pod api-gateway-123abc in namespace prod",
"description": null,
"source": "kubernetes_api_server",
"priority": "HIGH",
"started_at": "2024-09-03T04:09:31.342818+00:00",
"resolved_at": null,
"cluster": "prod-cluster-1",
"namespace": "prod",
"app": "api-gateway",
"kind": null,
"resource_name": "api-gateway-123abc",
"resource_node": "gke-prod-cluster-1-node-1"
},
{
"alert_name": "CrashLoopBackoff",
"title": "Crashing pod billing-service-xyz789 in namespace billing",
"description": null,
"source": "kubernetes_api_server",
"priority": "HIGH",
"started_at": "2024-09-03T04:09:31.496713+00:00",
"resolved_at": null,
"cluster": "prod-cluster-2",
"namespace": "billing",
"app": "billing-service",
"kind": null,
"resource_name": "billing-service-xyz789",
"resource_node": "gke-prod-cluster-2-node-3"
}
]
Response FieldsΒΆ
Field |
Type |
Description |
---|---|---|
|
string |
Name of the alert (e.g., |
|
string |
A brief description of the alert event. |
|
string |
Source of the alert (e.g., |
|
string |
Priority level of the alert (e.g., |
|
string |
Timestamp when the alert was triggered, in ISO 8601 format. |
|
string |
Timestamp when the alert was resolved, or |
|
string |
The cluster where the alert originated. |
|
string |
Namespace where the alert occurred. |
|
string |
The application that triggered the alert. |
|
string |
Name of the resource that caused the alert. |
|
string |
The node where the resource is located. |
Quick Start ExampleΒΆ
There is a quick-start Prometheus report-generator on GitHub that demonstrates how to use the export APIs.