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.

PHP-FPM logoPHP-FPM Prometheus Alert Rules

4 Prometheus alerting rules for PHP-FPM.Exported via bakins/php-fpm-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/php-fpm/bakins-fpm-exporter.yml
warning

5.1.1.PHP-FPM max-children reached

PHP-FPM reached max children on {{ $labels.instance }} ({{ $value }} times in the last 5m)

- alert: PHP-FPMMax-childrenReached
  expr: sum(increase(phpfpm_max_children_reached_total[5m])) by (instance) > 3
  for: 0m
  labels:
    severity: warning
  annotations:
    summary: PHP-FPM max-children reached (instance {{ $labels.instance }})
    description: "PHP-FPM reached max children on {{ $labels.instance }} ({{ $value }} times in the last 5m)\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

5.1.2.PHP-FPM listen queue saturation

PHP-FPM listen queue on {{ $labels.instance }} is at {{ $value | humanizePercentage }} of the socket backlog length, new connections may soon be queued or dropped.

- alert: PHP-FPMListenQueueSaturation
  expr: sum(phpfpm_listen_queue_connections) by (instance) / sum(phpfpm_listen_queue_length_connections) by (instance) > 0.8
  for: 5m
  labels:
    severity: warning
  annotations:
    summary: PHP-FPM listen queue saturation (instance {{ $labels.instance }})
    description: "PHP-FPM listen queue on {{ $labels.instance }} is at {{ $value | humanizePercentage }} of the socket backlog length, new connections may soon be queued or dropped.\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

5.1.3.PHP-FPM busy process ratio high

{{ $value }}% of PHP-FPM processes are active (busy) on {{ $labels.instance }}, the pool is approaching its max_children capacity.

- alert: PHP-FPMBusyProcessRatioHigh
  expr: (sum(phpfpm_processes_total{state="active"}) by (instance) * 100) / sum(phpfpm_processes_total) by (instance) > 80
  for: 5m
  labels:
    severity: warning
  annotations:
    summary: PHP-FPM busy process ratio high (instance {{ $labels.instance }})
    description: "{{ $value }}% of PHP-FPM processes are active (busy) on {{ $labels.instance }}, the pool is approaching its max_children capacity.\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"
warning

5.1.4.PHP-FPM slow requests ratio

{{ $value | humanizePercentage }} of accepted connections on {{ $labels.instance }} exceed request_slowlog_timeout, indicating degraded PHP-FPM response times.

  # If this fires too often or too rarely, tune your PHP-FPM request_slowlog_timeout setting (which defines what counts as "slow") rather than this 10% ratio threshold.
- alert: PHP-FPMSlowRequestsRatio
  expr: sum(rate(phpfpm_slow_requests_total[5m])) by (instance) / sum(rate(phpfpm_accepted_connections_total[5m])) by (instance) > 0.1 and sum(rate(phpfpm_accepted_connections_total[5m])) by (instance) > 0
  for: 5m
  labels:
    severity: warning
  annotations:
    summary: PHP-FPM slow requests ratio (instance {{ $labels.instance }})
    description: "{{ $value | humanizePercentage }} of accepted connections on {{ $labels.instance }} exceed request_slowlog_timeout, indicating degraded PHP-FPM response times.\n  VALUE = {{ $value }}\n  LABELS = {{ $labels }}"