Prometheus HTTP API
The web interface Prometheus offers for running queries and inspecting targets, used by Grafana and by scripts.
In more detail
An instant query is a GET or POST to /api/v1/query with a query and an optional time; the reply is JSON. Grafana's Prometheus data source uses the same API.
Examples
curl -sG --data-urlencode 'query=up' http://localhost:9090/api/v1/queryThe course script query.sh wraps it with curl and jq.Related terms
- PromQL — The query language of Prometheus, used to select time series and calculate rates, sums and percentiles from them.
- instant query — A PromQL query evaluated at a single moment, returning the latest value of each series.
- curl — A command-line tool for sending web requests and printing the response.
- jq — A command-line tool that reads, filters and reshapes JSON data.
Taught in
- Grafana: Connecting The Data Source — Full-Stack Observability: Metrics, Tracing & Logging