PHP-FPM

Monitor PHP-FPM queue pressure, worker pool saturation, and request throughput from the local FastCGI status endpoint. The agent connects directly to PHP-FPM over FastCGI and reads the status page in JSON format to surface backlog, concurrency, and slow-request behavior.

Setup

Preparing PHP-FPM for monitoring requires enabling the pool status endpoint and exposing it on the default local FastCGI listener used by the agent.

  1. Enable the status endpoint: In the PHP-FPM pool you want to monitor, set pm.status_path = /status.
  2. Expose FastCGI locally: Ensure the pool listens on 127.0.0.1:9000, which is the address currently used by auto-discovery.
  3. Restart PHP-FPM: Reload the service to apply the new pool configuration, for example sudo systemctl restart php8.2-fpm.
  4. Restart the agent: Restart simob to trigger service discovery for the new endpoint: sudo systemctl restart simob.
  5. Enable in UI: Once discovered, explicitly enable the PHP-FPM collector in your dashboard’s server configuration panel.

Example pool configuration:

[www]
listen = 127.0.0.1:9000
pm.status_path = /status

Configuration

The agent automatically discovers PHP-FPM when the status page is exposed through FastCGI on 127.0.0.1:9000 with the path /status and the JSON status format enabled through the ?json query string. No additional agent configuration is required for standard installations.

Metrics

The following metrics are collected from the PHP-FPM status output:

MetricTypeUnitDescription
phpfpm_listen_queue_totalGauge-Number of requests currently waiting in the listen queue.
phpfpm_max_listen_queue_totalGauge-Highest queue depth reached since PHP-FPM started.
phpfpm_listen_queue_length_totalGauge-Maximum number of requests the listen queue can hold.
phpfpm_idle_processes_totalGauge-Number of idle worker processes ready to handle requests.
phpfpm_active_processes_totalGauge-Number of worker processes currently serving requests.
phpfpm_processes_totalGauge-Total number of PHP-FPM worker processes.
phpfpm_max_active_processes_totalGauge-Highest number of simultaneously active workers since startup.
phpfpm_accepted_connections_rateGaugeconns/sRate of accepted FastCGI connections per second.
phpfpm_max_children_reached_totalCountertotalNumber of times the pool hit its configured worker limit.
phpfpm_slow_requests_rateGaugereqs/sRate of requests marked as slow per second.

Troubleshooting

Verify the endpoint

If the cgi-fcgi utility is installed, you can manually query the status endpoint over FastCGI:

SCRIPT_NAME=/status \
SCRIPT_FILENAME=/status \
REQUEST_METHOD=GET \
QUERY_STRING=json \
cgi-fcgi -bind -connect 127.0.0.1:9000

The response should include a JSON payload with fields such as listen queue, active processes, and slow requests.

Discovery requirements

If PHP-FPM is not appearing in the UI, verify that:

  • the pool is listening on 127.0.0.1:9000
  • pm.status_path is set to /status
  • the agent was restarted after the PHP-FPM configuration changed

Current auto-discovery only supports the default TCP listener and status path above.