Global PHP-FPM status page via global custom2 variable

Snel

Verified User
Joined
Mar 8, 2016
Messages
15
Location
Rotterdam, The Netherlands
I'm trying to enable php-fpm status page for all PHP-FPM pools as per the instructions on DirectAdmin Docs and listed feature.

Running DirectAdmin version 1.63.7 so this should be supported.

I'm editing /usr/local/directadmin/data/templates/custom/php-fpm.conf.custom2. I have created the file and the file contains 1 line:
Code:
pm.status_path = /php-fpm-status

I have rewritten the configurations with:
Code:
/usr/local/directadmin/custombuild/build rewrite_confs

Unfortunately this line is not being added to /usr/local/directadmin/data/users/*/php/php-fpm*.conf.

If I add this to CUSTOM2 through Custom HTTPD Configurations it does work as expected.

Am I missing something?
 
try: echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
 
Unfortunately that doesn't help.

Adding another value in custom2 through Custom HTTPD Configurations also doesn't work so it doesn't look like a problem with triggering the config rewriting.
 
try
/usr/local/directadmin/custombuild/build php
then
/usr/local/directadmin/custombuild/build rewrite_confs

php-fpm status page for all PHP-FPM pools as per the instructions on DirectAdmin Docs and listed feature.
I dont see anything on that page about the php-fpm-status

Dont you need to add it to http configs?

This might help its old and nginx
 
maybe it should name with uppercase
Tried this, doesn't make a difference.

I dont see anything on that page about the php-fpm-status

Dont you need to add it to http configs?

That's the last part, making it available through the webserver. For that part to work the pm.status_path needs to be set in the PHP-FPM pool settings. As explained earlier, I have everything working when I add the same code to CUSTOM2 for a specific website through Custom HTTPD Configurations.

try
/usr/local/directadmin/custombuild/build php
then
/usr/local/directadmin/custombuild/build rewrite_confs

Can't try this yet, server is in production. Awaiting other suggestions before I try this one because DirectAdmin documentation doesn't mention anything like this.

I'm expecting that this is a bug but I'm open to suggestions.
 
server is in production.
Totally get it.. I assumed you were testing in a Non Prod.

I would open a Support request. I think you all are only 1 of 2 or 3 ever asked about this.
 
No, this will make the status page of PHP-FPM for all PHP-FPM pools available at the URL /php-fpm-status. We request this page through the commandline by making use of the PHP socket (in an automated way within zabbix).

If you need the PHP-FPM status page publicly available through either Apache or Nginx you should redirect incoming requests on the webserver at /php-fpm-status to the PHP-FPM server.

For example with Apache only configuration you go to Custom HTTPD Configurations and click on httpd.conf for the website you wish to configure this for.

Next click on "Customize" under "Actions".

And add the following code to CUSTOM2:
Code:
<LocationMatch "/php-fpm-status">
RewriteEngine Off
Require local
Require ip xx.xx.xx.xx
SetHandler "proxy:unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock|fcgi://localhost"
</LocationMatch>

This will make the PHP-FPM status page available on http(s)://domain.com/php-fpm-status from localhost or from IP xx.xx.xx.xx. Adjust as necessary.

For Nginx it is similar. Go to Custom HTTPD Configurations and click on httpd.conf for the website you wish to configure this for.

Next click on "Customize" under "Actions".

And add the following code to CUSTOM3:

Code:
location ~ ^/(php-fpm-status)$ {
allow 127.0.0.1;
allow xx.xx.xx.xx;
deny all;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock;
}
 
No, this will make the status page of PHP-FPM for all PHP-FPM pools available at the URL /php-fpm-status.
Yes a php-fpm status page.

For example with Apache only configuration you go to Custom HTTPD Configurations and click on httpd.conf for the website you wish to configure this for.
Ah oke so it's not a server-wide thing like the apache status page. I thought this would create a php-fpm status page with status of all php-fpm in use at that moment. Seems I thought wrong.

Thank you for the nice examples tho!
 
Ah, I thought it would be some status page like an overview, same what you get when you use this command in console.
ps aux | grep "php-fpm: pool"
But I just found some screenshots, so I see it's something totally different from what I thought. Thank you.
 
No, this will make the status page of PHP-FPM for all PHP-FPM pools available at the URL /php-fpm-status. We request this page through the commandline by making use of the PHP socket (in an automated way within zabbix).
Apologies for responding to this old thread, but do you actually connect directly to the unix socket to fetch the php-fpm status? If so, how? I've so far failed to figure out how I would communicate directly with php-fpm from a script.
 
@kristian
if on nginx, use fastcgi


example when working with nginx template
Code:
location ~ ^/(status|ping)$ {
        allow 127.0.0.1;
        deny all;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
        include fastcgi_params;     
        fastcgi_pass   unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock;
}

so if you just want to curl to their domains with some bash script.
Code:
curl http://www.domain.com/status --resolve www.domain.com:80:127.0.0.1
 
Thanks. I know I can access it through nginx/apache in this way, but it seems overly complicated to have a location definition in every single customer vhost, and needing to make the request to the customer domain. And then you have a customer (user) with multiple domains, on different php versions, and it all gets really messy in my head. :)

I think I've found a way to do a direct connection to php-fpm though, that can work for feeding the data into Zabbix (as mentioned earlier in this thread, but other monitoring systems can probably do much the same thing).

I'll post an update when I have something that's working reliably.
 
Apologies for responding to this old thread, but do you actually connect directly to the unix socket to fetch the php-fpm status? If so, how? I've so far failed to figure out how I would communicate directly with php-fpm from a script.
We're using the following method:

Works when connecting to socket too.
 
Back
Top