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.

Cloudflare logoCloudflare Prometheus Alert Rules

5 Prometheus alerting rules for Cloudflare.Exported via lablabs/cloudflare-exporter.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. 😉

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

9.9.1.Cloudflare load balancer pool unhealthy

Cloudflare load balancer pool {{ $labels.pool_name }} for zone {{ $labels.zone }} is reporting as unhealthy, meaning origin servers behind this pool may be unreachable.

- alert: CloudflareLoadBalancerPoolUnhealthy
  expr: cloudflare_zone_pool_health_status == 0
  for: 2m
  labels:
    severity: critical
  annotations:
    summary: Cloudflare load balancer pool unhealthy (instance {{ $labels.instance }})
    description: "Cloudflare load balancer pool {{ $labels.pool_name }} for zone {{ $labels.zone }} is reporting as unhealthy, meaning origin servers behind this pool may be unreachable.\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
critical

9.9.2.Cloudflare http 5xx error rate

Cloudflare high HTTP 5xx error rate (> 5% for domain {{ $labels.zone }})

- alert: CloudflareHttp5xxErrorRate
  expr: (sum by (zone) (rate(cloudflare_zone_requests_status{status=~"^5.."}[5m])) / on (zone) sum by (zone) (rate(cloudflare_zone_requests_status[5m]))) * 100 > 5 and sum by (zone) (rate(cloudflare_zone_requests_status[5m])) > 0
  for: 0m
  labels:
    severity: critical
  annotations:
    summary: Cloudflare http 5xx error rate (instance {{ $labels.instance }})
    description: "Cloudflare high HTTP 5xx error rate (> 5% for domain {{ $labels.zone }})\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

9.9.3.Cloudflare http 4xx error rate

Cloudflare high HTTP 4xx error rate (> 5% for domain {{ $labels.zone }})

  # 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: CloudflareHttp4xxErrorRate
  expr: (sum by(zone) (rate(cloudflare_zone_requests_status{status=~"^4.."}[15m])) / on (zone) sum by (zone) (rate(cloudflare_zone_requests_status[15m]))) * 100 > 5 and sum by (zone) (rate(cloudflare_zone_requests_status[15m])) > 0
  for: 0m
  labels:
    severity: warning
  annotations:
    summary: Cloudflare http 4xx error rate (instance {{ $labels.instance }})
    description: "Cloudflare high HTTP 4xx error rate (> 5% for domain {{ $labels.zone }})\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

9.9.4.Cloudflare high threat count

Cloudflare zone {{ $labels.zone }} recorded {{ $value }} threats (WAF/DDoS blocks) in the last 5 minutes, which may indicate an ongoing attack.

  # 3 threats per 5m is a rough default; adjust based on your zone's typical traffic and threat baseline.
- alert: CloudflareHighThreatCount
  expr: sum by (zone) (increase(cloudflare_zone_threats_total[5m])) > 3
  for: 0m
  labels:
    severity: warning
  annotations:
    summary: Cloudflare high threat count (instance {{ $labels.instance }})
    description: "Cloudflare zone {{ $labels.zone }} recorded {{ $value }} threats (WAF/DDoS blocks) in the last 5 minutes, which may indicate an ongoing attack.\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

9.9.5.Cloudflare high request rate

Cloudflare zone {{ $labels.zone }} request rate over the last 10 minutes is {{ $value }}% of the preceding 50-minute baseline, indicating an abnormal traffic spike (possible DDoS or misconfigured client).

- alert: CloudflareHighRequestRate
  expr: sum by (zone) (100 * (rate(cloudflare_zone_requests_total[10m]) / clamp_min(rate(cloudflare_zone_requests_total[50m] offset 10m), 1))) > 150
  for: 0m
  labels:
    severity: warning
  annotations:
    summary: Cloudflare high request rate (instance {{ $labels.instance }})
    description: "Cloudflare zone {{ $labels.zone }} request rate over the last 10 minutes is {{ $value }}% of the preceding 50-minute baseline, indicating an abnormal traffic spike (possible DDoS or misconfigured client).\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"