DevTools Logo

Prometheus Alert Rule Builder

Prometheus Alert Rule Builder

Build Prometheus alerting rules — groups, alerts, expressions, durations, labels, and annotations.

Group

Rule 1

rules.yml

groups:
  - name: service-alerts
    rules:
      - alert: HighRequestLatency
        expr: rate(http_request_duration_seconds_sum[5m]) > 0.5
        for: 10m
        labels:
          severity: warning
        annotations:
          summary: "High request latency on {{ $labels.instance }}"
          description: "Average request latency is above 0.5s for the last 10 minutes."
client-side
YAML

Examples

High latency alert

Input
alert HighRequestLatency
expr rate(http_request_duration_seconds_sum[5m]) > 0.5
for 10m, severity warning
Output
groups:
  - name: service-alerts
    rules:
      - alert: HighRequestLatency
        expr: rate(http_request_duration_seconds_sum[5m]) > 0.5
        for: 10m
        labels:
          severity: warning

An alert fires when the 5-minute average latency stays above 0.5s for 10 minutes.

About this tool

The Prometheus Alert Rule Builder writes an alerting rules YAML. Set a group name and add rules — each with an alert name, a PromQL expression, a for duration, a severity label, and summary/description annotations. The output is a rules file you load into Prometheus — nothing is uploaded.

How to use

  1. Name the group

    Group related alerts under one name for organisation.

  2. Add rules

    Each rule needs an expression; for, severity, and annotations make it useful.

  3. Load into Prometheus

    Reference the file from rule_files and reload Prometheus.

Use cases

Service SLOs

Turn latency or error-rate SLOs into concrete alerting rules.

Common mistakes

Mistake:Forgetting the for duration.

Fix:Without a for, a single scrape spike pages you immediately; add a duration to smooth noise.

Frequently asked questions

References & standards