[ZBX-21304] PHP-FPM template php-fpm.ping reports false down Created: 2022 Jul 05  Updated: 2024 Apr 10  Resolved: 2022 Sep 08

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Templates (T)
Affects Version/s: 6.0.6, 6.2.0
Fix Version/s: 5.0.28rc1, 6.0.9rc1, 6.2.3rc1, 6.4.0alpha1, 6.4 (plan)

Type: Problem report Priority: Trivial
Reporter: Jerzy Drożdż Assignee: Denis Rasikhov
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Team: Team INT
Sprint: Sprint 92 (Sep 2022)
Story Points: 1

 Description   

Both "PHP-FPM by HTTP" and "PHP-FPM by Zabbix agent" are affected.

Steps to reproduce:

  1. Configure host to provide php-fpm /status and /ping page
  2. Enable and start php-fpm and http server
  3. Add PHP-FPM template to host

 

Result:

php-fpm.ping = "Down(0)"
**

Expected:
php-fpm.ping = "Up(1)"

 

Resolution:

Change regular expression in preprocessing for php-fpm.ping:

from: {$PHP_FPM.PING.REPLY}($|\n)

to: {$PHP_FPM.PING.REPLY}($|\r?\n)



 Comments   
Comment by Denis Rasikhov [ 2022 Sep 05 ]

Hi t0fik !

I've tested both templates with the following setups:

1. Rocky Linux 8.6, Zabbix 6.2.2:

  • php-fpm 7.4.19
  • nginx 1.22
  • mysql 8.0.30

2. Rocky Linux 8.6, Zabbix 6.0.6

  • php 7.2
  • nginx 1.14
  • mysql 8.0.26

3. Debian 11, Zabbix 5.0.24:

  • php 7.4.28
  • nginx 1.18
  • postgresql 14.4

4. Debian 11, Zabbix 6.2.2:

  • php 7.4.30
  • nginx 1.18
  • mysql 8.0.30

I've set up Zabbix to monitor PHP-FPM on itself (same VM) and I could not reproduce the error in any of the specified configs, it works as expected. Could you give more details about the environment you have?

Comment by Jerzy Drożdż [ 2022 Sep 05 ]

Setup:

Zabbix server 6.0.8 (AlmaLinux 8.6):

  • php-fpm 7.2
  • nginx 1.14
  • PostgreSQL 13.7

Monitored host (AlmaLinux 8.6), different VM:

  • Template used: PHP-FPM by Zabbix agent
  • Apache 2.4
  • php-fpm 7.4.30
  • zabbix-agent2 6.0.8

Virtual host configuration:

<VirtualHost [::]:80>
  ServerName localhost
  <Location "/server-status">
    SetHandler server-status
  </Location>
  <Location ~ "^/(status|ping)$">
    SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
  </Location>
</VirtualHost> 

Data processed by regex are raw HTTP server response with '\r\n' EOLs.

Adding '\r?' to the regular expression is backward compatible.

Comment by Denis Rasikhov [ 2022 Sep 06 ]

The reason behind these line endings is usage of agent 2. Probably it was made this way for compatibility with Windows or something. Yeah, we'll add optional "\r" to the regex then.

Comment by Jerzy Drożdż [ 2022 Sep 06 ]

Nice to hear. CRLF is standard EOL for HTTP message, maybe agent2 do not convert that. I've got whole HTTP message (headers + body) to parse by regular expression.

IMHO no data conversion is a good thing in this case.

 

Comment by Denis Rasikhov [ 2022 Sep 06 ]

Fixed in:

Generated at Thu Jun 19 08:50:08 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.