[ZBX-21519] PHP-FPM by Zabbix agent Created: 2022 Aug 26  Updated: 2024 Apr 10  Resolved: 2022 Nov 01

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Templates (T)
Affects Version/s: None
Fix Version/s: 5.0.29rc1, 6.0.10rc1, 6.2.4rc1, 6.4.0beta2, 6.4 (plan)

Type: Problem report Priority: Trivial
Reporter: Daniel Gibbs Assignee: Vyacheslav Khaliev
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File template_app_php-fpm_agent.yaml    
Team: Team INT
Sprint: Sprint 92 (Sep 2022), Sprint 93 (Oct 2022)
Story Points: 0.125

 Description   

Steps to reproduce:

  1. Use the PHP-FPM by Zabbix agent template
  2. PHP-FPM: Number of processes running returns no processes

[bug report] PHP-FPM: Process is not running - ZABBIX Forums

Result:
Returns 0 when PHP-FPM processes are running
Expected:
Returns number of PHP-FPM processes running

Fix:

update PHP-FPM templates as follows

1. Add a new macro to the template

the user is typically www-data but do ps -ef|grep php-fpm to confirm

Macro: {$PHP_FPM.USER}
Value: www-data

2. Update existing Item "PHP-FPM: Number of processes running" key
from
Code:
proc.num["\{$PHP_FPM.PROCESS_NAME}"]
to:
Code:
proc.num[,"\{$PHP_FPM.USER}",,"\{$PHP_FPM.PROCESS_NAME}"]

I have uploaded the edited template from zabbix 6.0.7 that will hopfully help.



 Comments   
Comment by Denis Rasikhov [ 2022 Sep 08 ]

The reason behind this is that the actual process names may differ, depending on used OS distribution. E.g Debian/Ubuntu - php-fpm7.4, php-fpm8.1; RHEL-like - php-fpm. Same for Apache (DEB - apache2, RPM - httpd). Actual process name can be found in line "Name" of /proc/<pid>/status file (10 Notes on selecting processes in proc.mem and proc.num items (zabbix.com)).

The proposed solution doesn't take the master process into account (the user is root and not www-data/apache).

The issue will be resolved for 6.2 and upcoming 6.4 in ZBXNEXT-7924 Switch templates to proc.get - ZABBIX SUPPORT , which will allow to discover processes by their names using regex.

For 5.0 and 6.0 notes about actual process names depending on OS distribution were added.

Comment by Denis Rasikhov [ 2022 Sep 08 ]

Fixed in:

Generated at Fri Jun 06 20:10:27 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.