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 Traefik services are down

- alert: TraefikServiceDown
  expr: count(traefik_service_server_up) by (service) == 0
  for: 0m
  labels:
    severity: critical
  annotations:
    summary: Traefik service down (instance {{ $labels.instance }})
    description: "All Traefik services 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.

- 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 Traefik backends are down

- alert: TraefikBackendDown
  expr: count(traefik_backend_server_up) by (backend) == 0
  for: 0m
  labels:
    severity: critical
  annotations:
    summary: Traefik backend down (instance {{ $labels.instance }})
    description: "All Traefik backends 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 }}"