Monitoring php-fpm

Hello everyone!

This morning I decided to install this Checkmk Exchange
But I am facing a few problem.

I am running a Ubuntu20.04 cmk server and I am under the version 2.0.0p4.
I added the check on the host I want to monitor under

/usr/lib/check_mk_agent/plugins/php_fpm_pools

I also added the config under

cat /etc/check_mk/php_fpm_pools.cfg
php_fpm = [
{“socket”: “/var/run/php/php7.3-fpm.sock”, “path”: “/status”}
]

Under ubuntu20.04 it seems that by default there is no python but there is python3 so I had to modify the start of the script to say

#!/usr/bin/env python3

Executing the file now gives me a

Traceback (most recent call last):
File “./php_fpm_pools”, line 140, in
execfile(config_file)
NameError: name ‘execfile’ is not defined

So I modified line 140 from

execfile(config_file)

to

exec(open(“/etc/check_mk/php_fpm_pools.cfg”).read())

I now get the desired output on the server be it from the script directly of from the check_mk_agent

<<<php_fpm_pools>>>
www dynamic start_time 1636382097
www dynamic start_since 7680
www dynamic accepted_conn 14413
www dynamic listen_queue 0
www dynamic max_listen_queue 0
www dynamic listen_queue_len 0
www dynamic idle_processes 149
www dynamic active_processes 1
www dynamic total_processes 150
www dynamic max_active_processes 200
www dynamic max_children_reached 1
www dynamic slow_requests 0

Now when I go to check_mk under wato and rescan the host. I don’t see anything php-fpm related appear. And this is where I am stuck. If someone had the chance to play with this.

Thanks in advance

It seems that after a few hours ( i went to do something else) the cmk server realized there was something new. It seems to work and I am able to add the check from WATO. I will look and see if it all now seems correct.

It is working.
I added a new php-fpm server to the monitoring and it’s all good.
So I guess the only thing that remain is the fact that some modification were necessary to make it work under ubuntu20.04/python3.

Hope this is usefull to someone at some point.

Have a great day everyone.

The execfile problem is already fixed inside the github repo :slight_smile:
But it would be good that you have a symlink in your system from python to python3 if only this one is installed.

Noted for the github repo part.
Hope I did not add too much noise!

And you are right about python. I am toying with the idea more and more to just have a python symlink since I am only using the default installed python3 under ubuntu.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.