php-fpm socket status check console

%%{
  init: {
    'theme': 'base',
    'themeVariables': {
      'primaryColor': '#3ed72b',
      'primaryTextColor': '#000',
      'primaryBorderColor': '#000',
      'lineColor': '#fff',
      'secondaryColor': '#e6f01b',
      'tertiaryColor': '#fff'
    }
  }
}%%


flowchart LR
   id1[/cgi-fcgi/]
   id2[/php-fpm /]
   id3[ get status]
   id4[/metrics/]
   id5[/processid/]
   id6[/state/]
   id7[/requests /]
   id8[/duration/]
   id1-->id2
   id2-->id3
   id3-->id4
   id3-->id5
   id3-->id6
   id3-->id7
   id3-->id8

Overview

  • console
    • php
      • fpm pool
      • get pool status
        • metrics
        • processid
        • state
        • requests
        • duration
        • cpu load
        • request memory

install needed packages

apt install libfcgi-bin -y

info: library for cgi-fcgi

get list of current running php sockets

ls /var/run/php/*.sock

info: var/run/php/php7.3-fpm-www.sock or var/run/php/php7.3-fpm-wwwXXX.sock

Get status of active pool worker with metrics

sudo -u www-data bash -c "export SCRIPT_NAME=/status; export SCRIPT_FILENAME=/status; export QUERY_STRING=full; export REQUEST_METHOD=GET; cgi-fcgi -bind -connect /var/run/php/php7.3-fpm-www.sock"

output in my case on my server

pool:                 www1
process manager: dynamic
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
accepted conn: 2
listen queue: 0
max listen queue: 0
listen queue len: 0
idle processes: 20
active processes: 1
total processes: 21
max active processes: 1
max children reached: 0
slow requests: 0

************************
pid: 17567
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 1
request duration: 826
request method: GET
request URI: /status?full
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 2097152

************************
pid: 17568
state: Running
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 1
request duration: 571
request method: GET
request URI: /status?full
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17569
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17570
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17571
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17572
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17573
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17574
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17575
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17576
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17577
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17578
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17579
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17580
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17581
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17582
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17583
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17584
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17585
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17586
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

************************
pid: 17587
state: Idle
start time: 14/Dec/2023:01:05:39 +0100
start since: 634
requests: 0
request duration: 0
request method: -
request URI: -
content length: 0
user: -
script: -
last request cpu: 0.00
last request memory: 0

info: in my case my fpm worker has minumum 21 sub worker