Skip to content
BleemeoBleemeo

PHP-FPM

Auto-Detection
Built-in Metrics

Bleemeo monitors PHP-FPM through automatic service detection and built-in metrics gathered from the PHP-FPM status page.

Glouton automatically detects PHP-FPM instances running on the host. To enable metrics gathering, PHP-FPM must expose its status page. Add the following to your pool configuration:

pm.status_path = /status

By default, Glouton accesses the status page at fcgi://<fpm-address>:<fpm-port>/status using FastCGI over the TCP port PHP-FPM listens on.

If using a UNIX socket, ensure the Glouton user has permission to access the socket. On Debian/Ubuntu, add the Glouton user to the www-data group:

Terminal window
sudo adduser glouton www-data

If the auto-detected parameters are incorrect or the default status URL does not match your configuration, you can override them manually.

Terminal window
sudo tee /etc/glouton/conf.d/99-php-fpm.conf > /dev/null << 'EOF'
service:
# For a PHP-FPM running outside a container
- type: "phpfpm"
address: "127.0.0.1"
port: 9000
stats_url: "fcgi://127.0.0.1:9000/status"
# For UNIX socket access, use:
# stats_url: "/var/run/php5-fpm.sock"
# For an additional PHP-FPM running outside a container
- type: "phpfpm"
instance: "NAME_ASSOCIATED_WITH_YOUR_ADDITIONAL_SERVICE"
address: "127.0.0.1"
port: 9001
stats_url: "fcgi://127.0.0.1:9001/status"
# For UNIX socket access, use:
# stats_url: "/var/run/php5-fpm2.sock"
# For a PHP-FPM running in a Docker container
- type: "phpfpm"
instance: "CONTAINER_NAME"
port: 9000
stats_url: "fcgi://my-server:9000/status"
EOF
MetricDescription
service_statusStatus of PHP-FPM
phpfpm_accepted_connNumber of requests per second
phpfpm_active_processesNumber of active processes
phpfpm_idle_processesNumber of idle processes
phpfpm_listen_queueNumber of requests in the queue of pending connections
phpfpm_listen_queue_lenSize of the queue of pending connections
phpfpm_max_active_processesMaximum number of active processes since FPM started
phpfpm_max_children_reachedNumber of times the process limit has been reached
phpfpm_max_listen_queueMaximum number of requests in the queue of pending connections since FPM started
phpfpm_slow_requestsNumber of slow requests per second
phpfpm_start_sinceTime spent since PHP-FPM start in seconds
phpfpm_total_processesNumber of idle and active processes

See Troubleshoot a Service Check or Missing Metrics for what applies to every service: finding the address and port Glouton really uses, what each check message means, and how to read the collection error — which does not appear in the agent logs at the default level.

The check only opens the TCP port PHP-FPM listens on. A pool that listens on a UNIX socket has no TCP port, so there is nothing to check: the service stays OK as long as it is detected, and only the absence of metrics tells you something is wrong.

Status text Cause Fix
TCP port 9000, Connection refused The pool listens on another port or on a socket Set port, or rely on stats_url for the metrics
TCP port N, connection timed out after 10 seconds A firewall drops the packets Open the port for the agent

Glouton queries the FastCGI status page — stats_url if you set one, otherwise fcgi://<address>:<port>/status. Both the pool and the path have to cooperate:

Query the status page the way Glouton does, with cgi-fcgi from the libfcgi-bin package:

Terminal window
SCRIPT_NAME=/status SCRIPT_FILENAME=/status REQUEST_METHOD=GET cgi-fcgi -bind -connect 127.0.0.1:9000

Replace 127.0.0.1:9000 with the socket path for a socket-based pool.

What you see Cause Fix
a FastCGI error, or an empty response pm.status_path not enabled in the pool Add pm.status_path = /status to the pool configuration and reload PHP-FPM
a FastCGI error The status path is not /status Set stats_url to the real path, for example fcgi://127.0.0.1:9000/fpm-status
no address to connect to The pool listens on a UNIX socket Set stats_url to the socket path, for example /var/run/php/php8.2-fpm.sock
permission denied The agent cannot read the socket Add the Glouton user to the socket’s group: sudo adduser glouton www-data
metrics for one pool only Several pools on the same host Declare one service entry per pool, each with its own instance and stats_url