Glen Pitt-Pladdy :: Blogphp-fpm on Cacti via SNMP | |||
With higher scale sites php-fpm has become popular to boost efficiency and enable scaling out the application layer (eg. multiple dedicated application servers with php-fpm) and goes hand-in-hand with Nginx which is specifically designed to be extremely efficient at serving large numbers of concurrent requests and trivial to configure to work with php-fpm. In the same way as previous articles on Nginx on Cacti and Apache on Cacti, this article following on from my previous one on SNMP basics takes look at php-fpm graphing on Cacti. php-fpm Stats URLLike with Apache and Nginx, php-fpm has an easy to configure status URL which provides the few statistics about php-fpm that we monitor here. Configuring php-fpm to provide this requires commenting in the line in /etc/php5/fpm/pool.d/www.conf (at least on Debian) as follows: pm.status_path = /status Then to pass this through Nginx (this also provides the ping URL for testing php-fpm is alive), in the appropriate vhost to put something like: location ~ ^/(status|ping)$ { After reloading the configurations a request to http://localhost/status should provide a list of statistics that with a bit of processing with grep and sed can easily be turned into a list of numbers for snmpd to digest. Fortunately I've done that for you :-) Download: snmpd extension script and Cacti Template php-fpm on GitHub I put the snmpd extension script php-fpm-stats in /etc/snmp/ and set it executable then add the following lines to /etc/snmp/snmpd.conf to call the script for appropriate SNMP requests: # php-fpm Restart snmpd and you should be able to get basic stats via SNMP. Cacti TemplatesI have generated some basic Cacti Templates for php-fpm. Simply import the template cacti_host_template_php-fpm.xml, and add the graphs you want to the appropriate device graphs in Cacti. It should just work if your SNMP is working correctly for that device (ensure other SNMP parameters are working for that device). Graph Screen Shots
|
|||
Disclaimer: This is a load of random thoughts, ideas and other nonsense and is not intended to be taken seriously. I have no idea what I am doing with most of this so if you are stupid and naive enough to believe any of it, it is your own fault and you can live with the consequences. More importantly this blog may contain substances such as humor which have not yet been approved for human (or machine) consumption and could seriously damage your health if taken seriously. If you still feel the need to litigate (or whatever other legal nonsense people have dreamed up now), then please address all complaints and other stupidity to yourself as you clearly "don't get it".
Copyright Glen Pitt-Pladdy 2008-2023
|
Comments: