kreicer / zabbix-phpfpm-monitoring

PHP-fpm monitoring template for Zabbix with auto discovery, support for multiple pools
GNU General Public License v3.0
3 stars 3 forks source link

Zabbix PHP-fpm Template with Auto-discovery and support for multiple pools

Main features

Provided Items

We capture useful data from host and fpm status page:

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.

Provided Triggers

Provided Graphs

Processes for each pool

Zabbix Php-fpm Graph #1

Displays the following data:

Requests for each pool

Zabbix Php-fpm Graph #2

Displays the following data:

Installation

1. On Target server

Perform the following operations on all servers with Zabbix Agent and PHP-fpm from which you want to capture the data.

1.1 Install required packages

apt-get update
apt-get install jq libxml2-utils

1.2 Download the latest version of the php-fpm monitoring, install files, restart zabbix-agent

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"

1.3 Clean up

Delete temporary files:

rm /tmp/zabbix-phpfpm-monitoring.zip
rm -r /tmp/zabbix-phpfpm-monitoring/

2. On Zabbix Server

2.1 Import Zabbix php-fpm template

In Zabbix frontend go to "Configuration"->"Templates"->"Import":

Upload file /fpm_template.xml from the archive.

2.2 Add the template to your hosts

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).

Compatibility

Tested with:

Should work:

Not tested with:

If it works, please let me know.