Linux: Status eines UNIX-Sockets von PHP5-FPM abrufen (ohne Webserver)

This post was published 7 years 9 months 18 days ago, so the post may be outdated.

Es gibt die Möglichkeit einen Status eines PHP5-FPM Sockets über einen Webserver abzufragen. Ich war jedoch auf der Suche, den Status direkt vom Socket abzurufen, ohne Umweg über einen Webserver.

Zuerst muss man folgende Zeile in die Konfiguration des Sockets hinzuzufügen:

pm.status_path = /fpm-status

Danach kann man die Statistik mit einem – etwas längeren – Befehl abrufen:

export SCRIPT_FILENAME=/fpm-status; export SCRIPT_NAME=/fpm-status; cgi-fcgi -bind -connect /etc/php5/fpm/sockets/www.socket

Das Resultat sieht dann in etwa so aus:

Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Content-type: text/plain;charset=iso-8859-1
pool:                 patrik.kernstock.net
process manager:      dynamic
start time:           31/Dec/2012:20:57:44 +0100
start since:          567400
accepted conn:        93395
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       14
active processes:     1
total processes:      15
max active processes: 8
max children reached: 0
slow requests:        0

Wer ein kleines hilfreiches Bash-Script dafür sucht:
http://lumux.co.uk/2012/08/02/php-fpm-status-stats-without-a-webserver/

Author: Patrik Kernstock

May I introduce my self? I am Patrik Kernstock, 24 years old, perfectionist, born in Austria and living in Ireland, Cork. Me explained in short: Tech- and security enthusiast, series & movies junky. Interesting in Linux, Container-stuff and many software solutions by Microsoft, Veeam and VMware.

0 0 vote
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Shrenik
4 years ago

Hi Patrik,

Came to this through https://coderwall.com/p/jpzvxw/linux-get-socket-status-php5-fpm-via-linux-command

I did as ‘root’ as you have suggested but all I get is this –

export SCRIPTFILENAME=/php_fpm_status; export SCRIPTNAME=/php_fpm_status; cgi-fcgi -bind -connect /opt/bitnami/php/var/run/magento.sock

X-Powered-By: PHP/5.5.30
Content-type: text/html; charset=UTF-8

Please note that I have the same pm.status_path configured for viewing status via webserver also and that is working fine.