Check php-fpm-ping¶
Overview¶
Checks whether PHP-FPM is alive by fetching its ping monitoring page. Alerts when the reply differs from the expected "pong" or the page cannot be fetched at all, at the level --severity sets.
Important Notes:
-
Requires a configured ping page in PHP-FPM. Example PHP-FPM config:
text ping.path = /fpm-ping ping.response = pong -
Requires an Apache/nginx configuration to proxy the ping page. Example Apache config:
text Alias /fpm-ping /dev/null <Location "/fpm-ping"> Require local ProxyPass unix:/run/php-fpm/www.sock|fcgi://localhost/fpm-ping </Location>
Data Collection:
- Fetches the PHP-FPM ping page via HTTP (default:
http://localhost/fpm-ping) - Compares the response against the expected string (default: "pong")
Fact Sheet¶
| Fact | Value |
|---|---|
| Check Plugin Download | https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/php-fpm-ping |
| Nagios/Icinga Check Name | check_php_fpm_ping |
| Check Interval Recommendation | Every minute |
| Can be called without parameters | Yes |
| Runs on | Cross-platform |
| Compiled for Windows | No (runs with Python interpreter) |
Help¶
usage: php-fpm-ping [-h] [-V] [--always-ok] [--insecure] [--no-perfdata]
[--no-proxy] [--proxy PROXY] [--response RESPONSE]
[--severity {warn,crit}] [--timeout TIMEOUT] [-u URL]
Checks whether PHP-FPM is alive by fetching its ping monitoring page. Alerts
when the reply differs from the expected "pong" or the page cannot be fetched
at all, at the level `--severity` sets.
options:
-h, --help show this help message and exit
-V, --version show program's version number and exit
--always-ok Always returns OK.
--insecure This option explicitly allows insecure SSL
connections.
--no-perfdata Suppress the performance data section from the output.
The status message and the exit code are unaffected,
so alerting keeps working while trending data is
dropped.
--no-proxy Do not use a proxy, not even one the environment
names. Overrides `--proxy`.
--proxy PROXY Proxy to reach the target through. The scheme defaults
to `http` when omitted. Overrides the proxy the
environment names (`http_proxy`, `https_proxy`,
`all_proxy`) together with the exceptions it lists in
`no_proxy`, and is itself overridden by `--no-proxy`.
Without either parameter the environment applies.
Credentials belong into the environment variable
rather than here, because a command-line argument is
visible to every user on the host. Example:
`--proxy=http://proxy.example.com:3128`.
--response RESPONSE Expected PHP-FPM ping response string. Default: pong
--severity {warn,crit}
Severity for alerting. Default: warn
--timeout TIMEOUT Network timeout in seconds. Default: 8 (seconds)
-u, --url URL PHP-FPM ping URL. Default: http://localhost/fpm-ping
Documentation:
https://linuxfabrik.github.io/monitoring-plugins/check-plugins/php-fpm-ping/
Usage Examples¶
./php-fpm-ping --url=http://localhost/fpm-ping --response=pong --severity=crit
Output:
pong
States¶
- OK if PHP-FPM responds with the expected string (default: "pong").
- WARN or CRIT (depending on
--severity, default: WARN) if the response does not match the expected string. - WARN or CRIT (depending on
--severity) if the page cannot be fetched at all. A pool worker answers the ping, so a timeout means every worker is busy or stuck, and a refused connection means PHP-FPM or the web server in front of it is not running. --always-oksuppresses all alerts and always returns OK.
Perfdata / Metrics¶
| Name | Type | Description |
|---|---|---|
| ping | Number | 0 (STATE_OK) if the response matches, 1 (STATE_WARN) or 2 (STATE_CRIT) otherwise. |
Credits, License¶
- Authors: Linuxfabrik GmbH, Zurich
- License: The Unlicense, see LICENSE file.