check_php-fpm-status

Introduction

The check fetches several counters from php-fm-status page.

Requirements

  • wget
  • running PHP FPM service
  • enabled status page

To enable a status page as http://localhost/fpm-status.php

  • Set pm.status_path in your pool config eg. /etc/php/8.1/fpm/pool.d/www.conf
[www]
pm.status_path = /fpm-status.php
  • In your webservice config limit the access; here a snippet for Apache 2.4:
<Location /fpm-status.php>
  Require local
</Location>

Syntax

> check_php-fpm-status -h
______________________________________________________________________

CHECK_PHP-FPM-STATUS
v1.1

(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3

https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_php-fpm-status.html
______________________________________________________________________

The check fetches several counters from php-fm-status page.

It shows a short service status in a single line and then the dump of the 
status page.
For performance data it echos:

    php-fpm-active     count of active workers (="Rrunning" + "Reading headers")
    php-fpm-maxactive  max active processes (sum of idle + running + reading)
    php-fpm-idle       count of workers in state "Idle"
    php-fpm-running    count of workers in state "Running"
    php-fpm-reading    count of workers in state "Reading headers"
    php-fpm-queue      count of items in the queue
    php-fpm-maxqueue   max listen queue
    php-fpm-slow       slow requests per min (since last execution of this check)
    php-fpm-speed      requests per min (since last execution of this check)

SYNTAX:
check_php-fpm-status [-u URL]

OPTIONS:

    -u  url to fpm status page  (optional; default: localhost/status)
    -h or --help   show this help.

PARAMETERS:

    None.

EXAMPLE:
check_php-fpm-status -u http://localhost/my-custom-fpm-statuspage.php

Examples

./check_php-fpm-status -u localhost/fpm-status.php returns

OK: PHP-FPM service: running: 1 .. active: 2 (max: 5) .. idle workers: 3 .. queue: 0 .. speed: 1 req per min ... slow: 0 req per min (0%; total: 0)
Workers:               Running: 1
               Reading headers: 1
                          Idle: 3

  Waiting for a worker (queue): 0 (max: 0)

--- Status of service
  "pool": "www"
  "process manager": "dynamic"
  "start time": 1692402233
  "start since": 479084
  "accepted conn": 10960
  "listen queue": 0
  "max listen queue": 0
  "listen queue len": 0
  "idle processes": 3
  "active processes": 2
  "total processes": 5
  "max active processes": 5
  "max children reached": 0
  "slow requests": 0

--- workers in state Running
{"pid":588192,"state":"Running","start time":1692856027,"start since":25290,"requests":197,"request duration":42053467,"request method":"GET","request uri":"/fpm-status.php?full&json","content length":0,"user":"-","script":"-","last request cpu":0,"last request memory":0}

 |php-fpm-active=2;;;0;0 php-fpm-maxactive=5;;;0;0 php-fpm-queue=0;;;0;0 php-fpm-maxqueue=0;;;0;0 php-fpm-slow=0;;;0;0 php-fpm-speed=1;;;0;0 php-fpm-idle=3;;;0;0 php-fpm-running=1;;;0;0 php-fpm-reading=1;;;0;0