Check php-fpm-ping

Overview

This check fetches the ping monitoring page of PHP-FPM. This could be used to test from outside that FPM is alive and responding, to create a graph of FPM availability, or to trigger alerts for the operating team (24/7).

PHP-FPM config example:

; PHP-FPM Config
ping.path = /fpm-ping
ping.response = pong
# Apache Config
Alias /fpm-ping /dev/null
<Location "/fpm-ping">
    Require local
    ProxyPass unix:/run/php-fpm/www.sock|fcgi://localhost/fpm-ping
</Location>

Fact Sheet

Check Plugin Download

https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/php-fpm-ping

Check Interval Recommendation

Once a minute

Can be called without parameters

Yes

Available for

Python 2, Python 3, Windows

Requirements

Configure a ping page like /fpm-ping, /<poolname>-fpm-ping or similar in /etc/php-fpm.d/<poolname>.conf

Help

usage: php-fpm-ping [-h] [-V] [--always-ok] [--response RESPONSE]
                    [--severity {warn,crit}] [--test TEST] [-u URL]

Fetches the ping monitoring page of PHP-FPM.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  --always-ok           Always returns OK.
  --response RESPONSE   Expected PHP-FPM Ping response. Default: pong
  --severity {warn,crit}
                        Severity for alerting. One of "warn" or "crit".
                        Default: warn
  --test TEST           For unit tests. Needs "path-to-stdout-file,path-to-
                        stderr-file,expected-retc".
  -u URL, --url URL     PHP-FPM Ping URL. Default: http://localhost/fpm-ping

Usage Examples

./php-fpm-ping --url http://localhost/fpm-ping --response pong --severity crit

Output:

pong

States

  • WARN or CRIT if output is not identical to --response (default: „pong“), depending on the given severity (default: WARN)

Perfdata / Metrics

  • ping: 0 (= STATE_OK) if response is as expected, 1 (STATE_WARN) or 2 (STATE_CRIT) otherwise

Credits, License