Prometheus and PromQL 3 cheatsheet
Prometheus and PromQL 3: Running and checking
8 common Prometheus and PromQL 3 tasks.
Start Prometheus
Run Prometheus with a config file. The UI is at http://localhost:9090.
prometheus --config.file=prometheus.yml
Check the configuration
Validate prometheus.yml and the rule files it references before reloading.
promtool check config prometheus.yml
Check rule files
Validate the syntax of recording and alerting rules.
promtool check rules rules/api.yml
Unit-test alert rules
Run tests that supply sample series and check which alerts fire.
promtool test rules tests/alerts.test.yml
Reload the configuration
Reload without restarting. It needs --web.enable-lifecycle, or send SIGHUP.
curl -X POST http://localhost:9090/-/reload
Query over HTTP
Run an instant query against the HTTP API.
curl -G http://localhost:9090/api/v1/query --data-urlencode 'query=up'
Query from the command line
Run an instant query with promtool.
promtool query instant http://localhost:9090 'up == 0'
List scrape targets
See the health of every target through the API.
curl -s http://localhost:9090/api/v1/targets | jq '.data.activeTargets[] | {job: .labels.job, health: .health}'