Prometheus
Cheat sheet · https://pcornel.dk/topic.php?topic=6104
Answer
Prometheus is a pull-based metrics system: it scrapes HTTP /metrics endpoints, stores time series in a local TSDB, evaluates rules and sends alerts to Alertmanager.
Remember
Check target health at /targets first. Validate config with promtool before reloading. Local storage is not long-term or HA — use remote_write or Thanos/Mimir for that.
First checks
curl -s localhost:9090/api/v1/targets | jq '.data.activeTargets[] | {job:.labels.job,health,lastError}'— first check for this topiccurl -s localhost:9090/-/ready— Prometheus readycurl -s 'localhost:9090/api/v1/query?query=up'— scrape targets up/downpromtool check config prometheus.yml— config valid
Verify in this order
service discovery → scrape → TSDB → rules → alerts → Alertmanager
Where it usually breaks
Common failures are wrong discovery labels, scrape authentication/TLS issues, relabeling that drops targets or labels, cardinality explosions, remote-write backlog and dashboards querying a recording rule whose source expression changed.
Prometheus verification boundary matrix
| Boundary | Inspect | Healthy interpretation | Do not infer |
|---|---|---|---|
| Intent | Pull/scrape model | Intended object/scope is explicit and versioned where relevant | Intent is already effective |
| Owning runtime/control plane | Targets / Exporters | Owner accepts and reports the expected object state | Downstream dependencies are healthy |
| Effective state | Service discovery | Independent read-back matches the intended state | Every client sees the same result |
| Consumer outcome | PromQL fundamentals | The original bounded check succeeds in the same time window | Production correctness outside this scope |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6104