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.

Apache logoApache Prometheus Alert Rules

5 Prometheus alerting rules for Apache.Exported via Lusitaniae/apache_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/apache/lusitaniae-apache-exporter.yml
critical

4.2.1.Apache down

Apache down

- alert: ApacheDown
  expr: 'apache_up == 0'
  for: 0m
  labels:
    severity: critical
  annotations:
    summary: Apache down (instance {{ $labels.instance }})
    description: "Apache down\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
critical

4.2.2.Apache flapping

Apache on {{ $labels.instance }} changed state {{ $value | printf "%.0f" }} times in the last 10 minutes.

  # Catches a crash-looping service, which the down rule misses because each successful scrape resets its for: timer.
  # 4 changes means at least 2 down/up cycles in 10m; one outage followed by a recovery counts only 2.
- alert: ApacheFlapping
  expr: 'changes(apache_up[10m]) >= 4'
  for: 0m
  labels:
    severity: critical
  annotations:
    summary: Apache flapping (instance {{ $labels.instance }})
    description: "Apache on {{ $labels.instance }} changed state {{ $value | printf \"%.0f\" }} times in the last 10 minutes.\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

4.2.3.Apache workers load

Apache workers in busy state approach the max workers count 80% workers busy on {{ $labels.instance }}

- alert: ApacheWorkersLoad
  expr: '(sum by (instance) (apache_workers{state="busy"}) / sum by (instance) (apache_scoreboard) ) * 100 > 80 and sum by (instance) (apache_scoreboard) > 0'
  for: 2m
  labels:
    severity: warning
  annotations:
    summary: Apache workers load (instance {{ $labels.instance }})
    description: "Apache workers in busy state approach the max workers count 80% workers busy on {{ $labels.instance }}\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

4.2.4.Apache response time too high

Apache average response time on {{ $labels.instance }} is {{ $value }}ms over the last 5 minutes.

  # 5000ms threshold is a rough default; acceptable response time varies by route and your SLO — adjust based on your baseline.
- alert: ApacheResponseTimeTooHigh
  expr: 'increase(apache_duration_ms_total[5m]) / increase(apache_accesses_total[5m]) > 5000 and increase(apache_accesses_total[5m]) > 0'
  for: 2m
  labels:
    severity: warning
  annotations:
    summary: Apache response time too high (instance {{ $labels.instance }})
    description: "Apache average response time on {{ $labels.instance }} is {{ $value }}ms over the last 5 minutes.\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
info

4.2.5.Apache restart

Apache has just been restarted.

- alert: ApacheRestart
  expr: 'apache_uptime_seconds_total / 60 < 1'
  for: 0m
  labels:
    severity: info
  annotations:
    summary: Apache restart (instance {{ $labels.instance }})
    description: "Apache has just been restarted.\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.