Step‑by‑Step: Monitor Nginx and PHP‑FPM Status with Zabbix
This guide walks through configuring Zabbix to monitor Nginx and PHP‑FPM status, covering software installation paths, enabling status modules, creating extraction scripts, setting up Zabbix agent userparameters, restarting services, testing data retrieval, and adding server‑side templates for items, triggers, and graphs.
System Environment
zabbix installed in /usr/local/zabbix, nginx in /usr/local/nginx, php in /usr/local/php. Ensure nginx and php‑fpm ports are listening.
Configure nginx status
Confirm nginx status module compiled
Run nginx -V to check if http_stub_status_module is included.
Enable nginx status module
Modify nginx.conf and add a location block for the status page.
Test the configuration with nginx -t and reload if no errors.
View the status via a browser or curl command.
Interpret nginx status values
Configure php‑fpm status
Enable php‑fpm status page
Edit php-fpm.conf, uncomment the status page directive, and rename if desired.
View php‑fpm status
After editing, reload with service php-fpm reload, then access the status page via a browser or curl.
Examples for summary status page: http://example.com/status http://example.com/status?json http://example.com/status?html http://example.com/status?xml Example for detailed status page: http://example.com/status?full http://example.com/status?json&full http://example.com/status?html&full http://example.com/status?xml&full
Use curl localhost/php_fpm-status as an example output.
php‑fpm status meaning
Write status data extraction scripts
Place scripts in /usr/local/zabbix/bin.
nginx status extraction script
Script path:
/usr/local/zabbix/bin/nginx_status.shphp‑fpm status extraction script
Script path:
/usr/local/zabbix/bin/php_fpm_status.shCreate Zabbix agent sub‑configuration files
In /usr/local/zabbix/etc/zabbix_agentd.d/ create files linking the status scripts.
userparameter_nginx.conf
userparameter_php-fpm.conf
Ensure inclusion in zabbix_agentd.conf
Make sure Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/ is present and not commented out.
Restart zabbix_agentd
Run service zabbix_agentd restart to load the new configuration.
Test data collection with zabbix_get
On the Zabbix server, execute commands to fetch nginx and php‑fpm status values.
zabbix_getruns on the server.
Userparameter files reside on the agent side.
Extraction scripts reside on the agent side.
Use -s to specify the agent's IP address.
Add templates on Zabbix server
Create templates for nginx status and php‑fpm status, defining items, triggers, and graphs, then link them to the appropriate hosts or host groups.
Add nginx status template
Monitoring results
View the latest data and graphs in the Zabbix web UI to verify that items are being collected.
Summary
To monitor custom items in Zabbix: enable the software's status modules, write extraction scripts, configure userparameter files on the agent, restart the agent, add corresponding templates on the server, and associate them with hosts or host groups.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
