rvalitov / zabbix-php-fpm

PHP-FPM status monitoring template for Zabbix with auto discovery (LLD), support for multiple pools and ISPConfig
GNU General Public License v3.0
69 stars 20 forks source link

Pools with same name are mixed up #35

Closed rieschl closed 4 years ago

rieschl commented 4 years ago

Hi! I just installed the template and it's working quite well. Thank you for your efforts!

One thing I noticed is, that the discovery script has problems to distinguish the pools from different PHP versions. I have PHP7.3 and PHP7.4 installed, both having a prod and dev pool. The script seems to pick the first pool name it discovers and dismisses other pools from other PHP versions. My system is Debian 10, PHP is installed with deb.sury.org repo.

At first glance I don't know if it's even possible to distinguish those. Maybe with the socket name? I'd rather not rename the pools to be unique.

Thanks for your help!

rvalitov commented 4 years ago

Thank you very much! That's an interesting case. It didn't come to my mind that pools of different PHP versions may have the same names 🤔 Probably that's because I use it with ISPConfig that automatically generates unique names of pools among all PHP versions and pools.

It's possible to fix the discovery script, but the question is how to display pools of the same name in Zabbix? Currently pool name is a unique key, that identifies it. So probably I should switch to socket/ip and pool name pair.

rieschl commented 4 years ago

Hm, it's probably a good way to name each pool unique. For new setups I'll definitely consider that. But on existing servers it's a bit cumbersome to change pools, because of multiple places where I use it. In my setups I use the $pool variable to set the socket: listen = /run/php/php7.4-fpm-$pool.sock So I have to change that in Apache in the proxy_fcgi_module configs, too.

Afaik the socket (or ip) should already be unique, so maybe the pool name itself isn't even required.

Edit: Thinking of it... in my newer setups the socket isn't php7.4-fpm-$pool.sock as noted above, but php7.4-$pool-fpm.sock. So it should be possible to rename the pool to 7.4-dev and modify the socket to php$pool-fpm.sock. 🤷‍♂️

Edit2: I just tried to change the pool names on an "old" system to 7.x-xxx , the change is easier than I thought, and the discovery script is working as it should:

# ./zabbix_php_fpm_discovery.sh
{"data":[{"{#POOLNAME}":"7.3-dev","{#POOLSOCKET}":"/run/php/php7.3-dev-fpm.sock"},{"{#POOLNAME}":"7.3-prod","{#POOLSOCKET}":"/run/php/php7.3-prod-fpm.sock"},{"{#POOLNAME}":"7.4-dev","{#POOLSOCKET}":"/run/php/php7.4-dev-fpm.sock"}]}

That's good for me, so a change in the discovery script shouldn't be necessary. But maybe you should mention that in the installation instructions, that the pool names must be unique in the whole system.

Thanks for your help!

rvalitov commented 4 years ago

@rieschl a new PR is ready and published. Can you please test it and confirm that it works? For the test it's enough to update just the single file zabbix_php_fpm_discovery.sh on your machine. Thank you!

rvalitov commented 4 years ago

/remind me this issue in 10 days