Pcornel
Observability

Prometheus

Cheat sheet · https://pcornel.dk/topic.php?topic=6104

Back to the Topic

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 topic
  • curl -s localhost:9090/-/ready — Prometheus ready
  • curl -s 'localhost:9090/api/v1/query?query=up' — scrape targets up/down
  • promtool 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

BoundaryInspectHealthy interpretationDo not infer
IntentPull/scrape modelIntended object/scope is explicit and versioned where relevantIntent is already effective
Owning runtime/control planeTargets / ExportersOwner accepts and reports the expected object stateDownstream dependencies are healthy
Effective stateService discoveryIndependent read-back matches the intended stateEvery client sees the same result
Consumer outcomePromQL fundamentalsThe original bounded check succeeds in the same time windowProduction 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

Confirmation

Confirm action

Continue?