If you wish to monitor php-fpm pool, it provides status page determined by status_path configuration parameter in pool config file.
pm.status_path = /statusfpm
Status page usually looks like this:
accepted conn: 253745
process manager: static
idle processes: 50
active processes: 0
total processes: 50
The problem is that it is not usually accessible by HTTP, and you should usually use web-server to communcate with php-fpm by FastCGI protocol. Now let's imagine that you have 10 php-fpm nodes and one nginx server. It seems justified to get status from each php-fpm node, you should talk directly to php-fpm. And you can use php FCGIClient (big thanks to its author, Pierrick Charron) for this task.
Using this library is straightforward. The only difficulty is to send necessary headers to php-fpm. These headers we can find out with tcpdump, monitoring nginx and php-fpm communications. So, the following script can be used to retrieve distinct php-fpm statistics:
$client = new FCGIClient('192.168.0.1', '9000');
'GATEWAY_INTERFACE' => 'FastCGI/1.0',
'REQUEST_METHOD' => 'GET',
'SCRIPT_FILENAME' => '/usr/local/nginx/html/statusfpm', //Nginx document root
'SCRIPT_NAME' => '/statusfpm', //our pm.status_path
Recieved file can be analyzed further and result may be fed to your monitoring system:
//Line 0 (4 - with headers) - Accepted connections
//Line 3(7) - idle processes
//Line 4(8) - active processes
//Line 5(9) - total processes
The latest part depends on monitoring system you using. We have some service php functions to interact with zabbix (in particular, slightly modified zabbix_sender function).