Prometheus and PromQL 3 · Configuration, rules and alerts

Define an alert

Fire when the error ratio stays above 5% for ten minutes.

groups:
  - name: api-alerts
    rules:
      - alert: HighErrorRatio
        expr: sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m])) > 0.05
        for: 10m
        labels:
          severity: page
        annotations:
          summary: "More than 5% of requests are failing"

Official Prometheus and PromQL 3 documentation

More configuration, rules and alerts commands

All configuration, rules and alerts commands · Prometheus and PromQL 3 cheatsheet

Was this page helpful?