Range query for graph data

Fetch time-series data over a range for a rate metric

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'

tool
prometheus30 commands
tags
prometheusmonitoring

More prometheus commands

  • topk(10, sum by (pod) (rate(container_cpu_usage_seconds_total[5m])))

    PromQL: top 10 pods by CPU usage rate

  • 100 - (node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes{mountpoint="/"} * 100) > 85

    PromQL expression: fire when root disk > 85% used

  • curl -X POST http://prometheus:9090/-/reload

    Hot reload Prometheus config and rules without restart

  • curl -s http://prometheus:9090/api/v1/alerts | jq '.data.alerts[] | select(.state=="firing") | {name: .labels.alertname, severity: .labels.severity}'

    Show only firing alerts with name and severity

  • curl -s http://prometheus:9090/api/v1/label/__name__/values | jq '.data | length, .[0:20]'

    Count total metric names and preview first 20

all 30 prometheus commands