Articles on: Plugins

Monitoring PHP-FPM


The following metrics are submitted to Nixstats.

Accepted connections (per second, total)
Active processes
Total processes
Idle processes
Max active processes
Listen queue
Listen queue length
Max listen queue
Max children reached
Start time
Start since
Process manager
Slow requests



PHP-FPM status page

To enable the PHP-FPM status page add the following code to your PHP-FPM pool configuration file.

pm.status_path = /status_phpfpm

Now make the following changes to your NGiNX configuration file.

server {
    server_name localhost;
    location /status_phpfpm {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        deny all;

Or for Apache edit etc/apache2/mods-available/fastcgi.conf (or similar):

<IfModule mod_fastcgi.c>
        # Define a named handler
        AddHandler php7-fcgi .php
        # Generate an alias pointing to /usr/lib/cgi-bin/php[VersionNumber]-fcgi
        Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi
        # Configure an external server handling your upcoming requests (note where the alias is pointing towards)
        FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -socket /var/run/php/php7.0-fpm.sock -pass-header Authorization

         # only on if fpm-status is match. You might want to put this into your concrete vhost.conf file. For the testing, fastcgi.conf should work.
         <LocationMatch "/status_phpfpm">
             Order deny,allow
             Deny from all
             Allow from
             # set the before defined handler here
             SetHandler php7-fcgi
             # use the handler for the action handling virtual requests
             Action php7-fcgi /php7-fcgi virtual

You can test if the status page is working by running
wget -qO-

Configure the plugin

To enable the plugin edit the nixstats configuration file. This file is usually located at /etc/nixstats.ini.

Add the following settings to the end of the file.
enabled = yes
status_page_url =

Test to see if the plugin is working by running nixstatsagent --test phpfpm. It should show the following metrics:

    "accepted_conn": 3015,
    "accepted_conn_per_second": 0.0,
    "active_processes": 1,
    "idle_processes": 0,
    "listen_queue": 0,
    "listen_queue_len": 128,
    "max_active_processes": 1,
    "max_children_reached": 0,
    "max_listen_queue": 1,
    "pool": "www",
    "process_manager": "ondemand",
    "slow_requests": 0,
    "start_since": 294686,
    "start_time": 1492504250,
    "total_processes": 1

Now you can restart the agent service nixstatsagent restart to start monitoring PHP-FPM.

Updated on: 28/02/2019

Was this article helpful?

Share your feedback


Thank you!