Glen Pitt-Pladdy :: BlogPHP Zend opcache on Cacti via SNMP | |||
Previously I wrote up Cacti for PHP APC cache. While APC is widely used, Zend opcache has rapidly become the default PHP opcode cache for many. Monitoring the opcode cache is very important for PHP since if it is not working efficiently (eg. many evictions due to lack of memory) then PHP is going to be burning a lot of resource on continually recompiling code. This is essentially the same tricks for a new cache. Before attempting this, look at my previous article on SNMP basics takes look at general setup of snmpd and how basic extensions work. Extracting the statisticsTo extract stats from opcache we use the opcache_get_status() function and format the key fields as plain text to make it easy for snmpd to ingest. Download: PHP opcache monitoring scripts and Cacti Templates on GitHub The monitoring script opcachestat.php can be put somewhere it can be served by the webserver you are using with PHP. For example the configuration for Nginx with php-fpm for this placed in the root of a web site would be: location /opcachestat.php { Then to pick the data up via snmpd, add the following lines to /etc/snmp/snmpd.conf to call the script for appropriate SNMP requests: # php opcache Restart snmpd and you should be able to get basic stats via SNMP. Cacti TemplatesI have generated some basic Cacti Templates for opcache. Simply import the template cacti_host_template_php_opcache.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 ShotsFrom an extremely lightweight site...
|
|||
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: