Monitor a Linux service with Prometheus alerts
8 steps · about 2 h 47 min · Intermediate
- Understand the Prometheus data path (guide, Prometheus, 18 min)
Targets, scraping, time series, queries and alerts form one pipeline that should be designed as a whole.
- Design useful metric names and labels (guide, Prometheus, 20 min)
A disciplined dimensional model keeps queries expressive without creating uncontrolled cardinality.
- Run Prometheus and scrape a target (guide, Prometheus, 22 min)
A working local target makes configuration, discovery and scrape status concrete.
- Collect Linux host metrics (guide, Prometheus, 22 min)
Node Exporter supplies CPU, memory, filesystem and network signals for the service's operating context.
- Query rates ratios and time ranges (guide, Prometheus, 25 min)
PromQL selectors and ranges turn raw counters and gauges into evidence about current behaviour.
- Precompute a reusable service signal (guide, Prometheus, 18 min)
A recording rule gives dashboards and alerts one reviewed definition for an important rate or ratio.
- Write an actionable alert rule (guide, Prometheus, 20 min)
Duration, labels and annotations distinguish a sustained user-impacting condition from a noisy threshold.
- Unit-test the alert behaviour (guide, Prometheus, 22 min)
Rule tests prove when an alert should fire and what labels it produces before notifications depend on it.