- Supports auto discovery of pool (name)
- Easy and flexible configuration
- Low load on Zabbix server: most elements sending info by zabbix_sender
- Bash: no need to install Perl, PHP, Go or other languages
- Safe: no need to allow root for zabbix agent
We capture useful data from host and fpm status page:
-
PHP-fpm main statistic:
- Number of running php-fpm - the number of running php-fpm processes
-
For each pool:
- Uptime - the uptime of current pool
- Start time - the moment of launch of current pool
- Processes - the number of processes in total / active / idle state of current pool
- Memory used - the number and % of used memory by current pool
- Requests - the number of reqiests in accepted (per min) / queue / slow state of current pool
- Other - another stats from status page of current pool
History storage period is 7 days, trend storage period is 30 days. Data is captured every minute. These timings can be adjusted in template or per host if needed.
- PHP-fpm is not running
- {#POOL}: accepted connections over threshold
- {#POOL}: process manager was changed
- {#POOL}: queue detected
- {#POOL}: slow requests detected
- {#POOL}: used memory over threshold
- {#POOL}: was restarted
Displays the following data:
- Number of Active processes
- Number of IDLE processes
- Total number of processes
Displays the following data:
- Number of Accepted requests
- Number of Slow requests
- Queue
Perform the following operations on all servers with Zabbix Agent and PHP-fpm from which you want to capture the data.
apt-get update
apt-get install jq libxml2-utils
wget https://github.com/kreicer/zabbix-phpfpm-monitoring/archive/master.zip /tmp/zabbix-phpfpm-monitoring.zip
unzip /tmp/zabbix-phpfpm-monitoring.zip
cp /tmp/zabbix-phpfpm-monitoring/fpm-monitoring.conf /etc/zabbix/zabbix_agentd.conf/
cp /tmp/zabbix-phpfpm-monitoring/fpm-monitoring.sh /etc/zabbix/scripts/
chmod +x /etc/zabbix/scripts/fpm-monitoring.sh
systemctl restart zabbix-agent.service
If you using non-standart zabbix-agent.conf path change it in fpm-monitoring.sh
zabbixconf="/etc/zabbix/zabbix_agentd.conf"
Delete temporary files:
rm /tmp/zabbix-phpfpm-monitoring.zip
rm -r /tmp/zabbix-phpfpm-monitoring/
In Zabbix frontend go to "Configuration"->"Templates"->"Import"
:
Upload file /fpm_template.xml
from the archive.
Add template "PHP-fpm Template" to the hosts.
Add your status page address in the macros section of the host by adding value:
{$FPM_STATUS_URL}=your status page address
For few pools on one host: Add your status pages addresses in the macros section of the host. Example:
{$FPM_STATUS_URL}=statuspage1oIostatuspage2...
oIo - speacial symbols sequence for dividing status pages addresses (you can rewrite it in fpm-monitoring.sh).
div="oIo"
Rewrite tresholds (if needed):
{$FPM_MEM_WARN}=50 //mem % of total mem for trigger
{$FPM_CONN_WARN}=150 //number of accepted reqs per minute for trigger
Setup is finished, just wait 15 minutes till Zabbix discovers your providers and captures the data (or use manual check).
Tested with:
- Zabbix 4.2.5
- PHP 7.3
Should work:
- Zabbix 4.x
- Zabbix 3.x
- PHP 5.6
Not tested with:
- Zabbix 2.x
If it works, please let me know.