Monitor a Linux service with Prometheus alerts

8 steps · about 2 h 47 min · Intermediate

  1. 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.

  2. Design useful metric names and labels (guide, Prometheus, 20 min)

    A disciplined dimensional model keeps queries expressive without creating uncontrolled cardinality.

  3. Run Prometheus and scrape a target (guide, Prometheus, 22 min)

    A working local target makes configuration, discovery and scrape status concrete.

  4. Collect Linux host metrics (guide, Prometheus, 22 min)

    Node Exporter supplies CPU, memory, filesystem and network signals for the service's operating context.

  5. Query rates ratios and time ranges (guide, Prometheus, 25 min)

    PromQL selectors and ranges turn raw counters and gauges into evidence about current behaviour.

  6. 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.

  7. Write an actionable alert rule (guide, Prometheus, 20 min)

    Duration, labels and annotations distinguish a sustained user-impacting condition from a noisy threshold.

  8. 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.