Query instant vector prometheus
Run an instant PromQL query via HTTP API
curl -sG 'http://prometheus:9090/api/v1/query' --data-urlencode 'query=up' | jq '.data.result'
more prometheus
all 30 commands →
Range query for graph data
curl -sG 'http://prometheus:9090/api/v1/query_range' --data-urlencode 'query=rate(http_requests_total[5m])' --data-urlencode 'start=1h' --data-urlencode 'end=now' --data-urlencode 'step=60'
Top N series by value
topk(10, sum by (pod) (rate(container_cpu_usage_seconds_total[5m])))
Disk usage alert rule
100 - (node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes{mountpoint="/"} * 100) > 85
Reload Prometheus config
curl -X POST http://prometheus:9090/-/reload
List active alerts
curl -s http://prometheus:9090/api/v1/alerts | jq '.data.alerts[] | select(.state=="firing") | {name: .labels.alertname, severity: .labels.severity}'