Menu
Grafana Cloud
SLO API
Get started with and use the SLO API to create, manage, and maintain your SLOs.
To use the SLO API, complete the following steps.
Create a Grafana service account token (/docs/grafana/latest/administration/service-accounts/) with Editor permissions.
Using any HTTP client like
curl
or HTTPie, make calls to the plugin’s resource API.- Make your API calls to the SLO resource API: {stackURL}/api/plugins/grafana-slo-app/resources/v1/slo
- Use “Authorization: Bearer $APITOKEN” and “Accept application/json” as request headers.
- The plugin uses GET to list all SLOs or read a specific one.
- DELETE to delete an individual SLO.
- POST to create an SLO.
- PUT to update an SLO.
For a full definition of the API, download this OpenAPIv3 specification.
Here is an example request body to create an SLO:
json
{
"name":"HTTP Requests Kubelet Success Indicator",
"description":"99.5% of Kubelet HTTP Requests are not 5xx errors",
"destinationDatasource": {
"uid": "grafanacloud-prom"
},
"objectives":[
{
"value":0.995,
"window":"28d"
}
],
"query":{
"type":"ratio",
"ratio":{
"successMetric":{
"prometheusMetric":"kubelet_http_requests_total{status!~\"5..\"}"
},
"totalMetric":{
"prometheusMetric":"kubelet_http_requests_total"
},
"groupByLabels":[
"instance",
"job"
]
}
},
"alerting":{
"fastBurn":{
"annotations":[
{
"key":"name",
"value":"SLO Burn Rate Very High"
},
{
"key":"description",
"value":"Error budget is burning too fast."
}
]
},
"slowBurn":{
"annotations":[
{
"key":"name",
"value":"SLO Burn Rate High"
},
{
"key":"description",
"value":"Error budget is burning too fast."
}
]
}
}
}
Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video
Getting started with the Grafana LGTM Stack
In this webinar, we’ll demo how to get started using the LGTM Stack: Loki for logs, Grafana for visualization, Tempo for traces, and Mimir for metrics.
Video
Intro to Kubernetes monitoring in Grafana Cloud
In this webinar you’ll learn how Grafana offers developers and SREs a simple and quick-to-value solution for monitoring their Kubernetes infrastructure.
Video
Building advanced Grafana dashboards
In this webinar, we’ll demo how to build and format Grafana dashboards.