Skip to main content
APA
Sponsored byCAST AI — Kubernetes cost optimizationBetter Stack — Uptime monitoring and log managementVictoriaMetrics — Fast, open-source time series database and drop-in Prometheus replacement.

Traefik logoTraefik Prometheus Alert Rules

9 Prometheus alerting rules for Traefik.Exported via Embedded exporter v2, Embedded exporter v1.These rules cover critical and warning conditions — copy and paste the YAML into your Prometheus configuration.

⚠️

Alert thresholds depend on the nature of your applications. Some queries may have arbitrary tolerance thresholds. Building an efficient monitoring platform takes time. 😉

4.4.1.Traefik logoEmbedded exporter v2(6 rules)

wget https://raw.githubusercontent.com/samber/awesome-prometheus-alerts/refs/heads/master/dist/rules/traefik/embedded-exporter-v2.yml
critical

4.4.1.1.Traefik service down

All servers of Traefik service {{ $labels.service }} are down

  # max keeps one series per service and reads 0 once every server is down. count() counts series, not values,
  # so count(...) == 0 is never true.
- alert: TraefikServiceDown
  expr: 'max by (service) (traefik_service_server_up) == 0'
  for: 0m
  labels:
    severity: critical
  annotations:
    summary: Traefik service down (instance {{ $labels.instance }})
    description: "All servers of Traefik service {{ $labels.service }} are down\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
critical

4.4.1.2.Traefik high HTTP 4xx error rate service

Traefik service 4xx error rate is above 5%

  # 5% 4xx rate is a rough default. Client-error rates vary widely by service (bots, API misuse, rate limits, short-lived token expiry, scanners) — adjust based on your baseline.
- alert: TraefikHighHttp4xxErrorRateService
  expr: 'sum(rate(traefik_service_requests_total{code=~"4.*"}[3m])) by (service) / sum(rate(traefik_service_requests_total[3m])) by (service) * 100 > 5 and sum(rate(traefik_service_requests_total[3m])) by (service) > 0'
  for: 1m
  labels:
    severity: critical
  annotations:
    summary: Traefik high HTTP 4xx error rate service (instance {{ $labels.instance }})
    description: "Traefik service 4xx error rate is above 5%\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
critical

4.4.1.3.Traefik high HTTP 5xx error rate service

Traefik service 5xx error rate is above 5%

- alert: TraefikHighHttp5xxErrorRateService
  expr: 'sum(rate(traefik_service_requests_total{code=~"5.*"}[3m])) by (service) / sum(rate(traefik_service_requests_total[3m])) by (service) * 100 > 5 and sum(rate(traefik_service_requests_total[3m])) by (service) > 0'
  for: 1m
  labels:
    severity: critical
  annotations:
    summary: Traefik high HTTP 5xx error rate service (instance {{ $labels.instance }})
    description: "Traefik service 5xx error rate is above 5%\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
critical

4.4.1.4.Traefik certificate expiring imminently

TLS certificate for {{ $labels.sans }} served by Traefik instance {{ $labels.instance }} expires in less than 7 days and must be renewed urgently.

- alert: TraefikCertificateExpiringImminently
  expr: 'min by (instance, sans) (last_over_time(traefik_tls_certs_not_after[5m]) - time()) / 86400 < 7'
  for: 0m
  labels:
    severity: critical
  annotations:
    summary: Traefik certificate expiring imminently (instance {{ $labels.instance }})
    description: "TLS certificate for {{ $labels.sans }} served by Traefik instance {{ $labels.instance }} expires in less than 7 days and must be renewed urgently.\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

4.4.1.5.Traefik config reload failure

Traefik dynamic configuration reload is failing on {{ $labels.job }}, so recent routing and provider configuration changes may not be applied.

  # Traefik v3 removed traefik_config_reloads_failure_total with no replacement, so this rule only works on Traefik v2.
- alert: TraefikConfigReloadFailure
  expr: 'sum(rate(traefik_config_reloads_failure_total[3m])) by (job) > 0'
  for: 1m
  labels:
    severity: warning
  annotations:
    summary: Traefik config reload failure (instance {{ $labels.instance }})
    description: "Traefik dynamic configuration reload is failing on {{ $labels.job }}, so recent routing and provider configuration changes may not be applied.\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

4.4.1.6.Traefik certificate expiring soon

TLS certificate for {{ $labels.sans }} served by Traefik instance {{ $labels.instance }} expires in less than 14 days.

- alert: TraefikCertificateExpiringSoon
  expr: 'min by (instance, sans) (last_over_time(traefik_tls_certs_not_after[5m]) - time()) / 86400 < 14'
  for: 0m
  labels:
    severity: warning
  annotations:
    summary: Traefik certificate expiring soon (instance {{ $labels.instance }})
    description: "TLS certificate for {{ $labels.sans }} served by Traefik instance {{ $labels.instance }} expires in less than 14 days.\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"

4.4.2.Traefik logoEmbedded exporter v1(3 rules)

wget https://raw.githubusercontent.com/samber/awesome-prometheus-alerts/refs/heads/master/dist/rules/traefik/embedded-exporter-v1.yml
critical

4.4.2.1.Traefik backend down

All servers of Traefik backend {{ $labels.backend }} are down

  # max keeps one series per backend and reads 0 once every server is down. count() counts series, not values,
  # so count(...) == 0 is never true.
- alert: TraefikBackendDown
  expr: 'max by (backend) (traefik_backend_server_up) == 0'
  for: 0m
  labels:
    severity: critical
  annotations:
    summary: Traefik backend down (instance {{ $labels.instance }})
    description: "All servers of Traefik backend {{ $labels.backend }} are down\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
critical

4.4.2.2.Traefik high HTTP 4xx error rate backend

Traefik backend 4xx error rate is above 5%

  # 5% 4xx rate is a rough default. Client-error rates vary widely by application (bots, API misuse, rate limits, short-lived token expiry, malformed clients) — adjust based on your baseline.
- alert: TraefikHighHttp4xxErrorRateBackend
  expr: 'sum(rate(traefik_backend_requests_total{code=~"4.*"}[3m])) by (backend) / sum(rate(traefik_backend_requests_total[3m])) by (backend) * 100 > 5 and sum(rate(traefik_backend_requests_total[3m])) by (backend) > 0'
  for: 1m
  labels:
    severity: critical
  annotations:
    summary: Traefik high HTTP 4xx error rate backend (instance {{ $labels.instance }})
    description: "Traefik backend 4xx error rate is above 5%\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
critical

4.4.2.3.Traefik high HTTP 5xx error rate backend

Traefik backend 5xx error rate is above 5%

- alert: TraefikHighHttp5xxErrorRateBackend
  expr: 'sum(rate(traefik_backend_requests_total{code=~"5.*"}[3m])) by (backend) / sum(rate(traefik_backend_requests_total[3m])) by (backend) * 100 > 5 and sum(rate(traefik_backend_requests_total[3m])) by (backend) > 0'
  for: 1m
  labels:
    severity: critical
  annotations:
    summary: Traefik high HTTP 5xx error rate backend (instance {{ $labels.instance }})
    description: "Traefik backend 5xx error rate is above 5%\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"

Share your alerting rules

Your production alerts can make this collection better. Share your rule files in one command: only Prometheus rule files and PrometheusRule resources are uploaded, while prometheus.yml, alertmanager.yml and other configurations are skipped, as they often contain credentials.

npx awesome-prometheus-alerts share /etc/prometheus/rules

Add --dry-run to preview what would be sent.