PHP-FPM app update to handle multiple pools (#16122)

* checkpoint work for now

* polling should be good now

* re-work php-fpm some more

* re-work the php-fpm app page

* add php-fpm_v1_combined.inc.php

* add more graphs

* more work

* add last request cpu

* fix stats for pools

* more graph work

* update the docs for php-fpm

* more graph work

* more graph stuff

* graph stuff now done

* some style fixes

* another style fix

* remove a unneeded use line

* add new tests

* add some missing items to the test

* json fix

* remove start time and add data
This commit is contained in:
Zane C. Bowers-Hadley
2024-07-04 15:03:45 -05:00
committed by GitHub
parent ba8d7338a3
commit 1b5f5cee37
23 changed files with 731 additions and 44 deletions

View File

@@ -1905,26 +1905,41 @@ using it as a agent.
1. Copy the shell script, phpfpmsp, to the desired host
```
wget https://github.com/librenms/librenms-agent/raw/master/snmp/phpfpmsp -O /etc/snmp/phpfpmsp
wget https://github.com/librenms/librenms-agent/raw/master/snmp/php-fpm -O /etc/snmp/php-fpm
```
2. Make the script executable
```
chmod +x /etc/snmp/phpfpmsp
chmod +x /etc/snmp/php-fpm
```
3. Install the depends.
```shell
# FreeBSD
pkg install p5-File-Slurp p5-JSON p5-String-ShellQuote p5-MIME-Base64
# Debian
apt-get install libfile-slurp-perl libjson-perl libstring-shellquote-perl libmime-base64-perl
```
3. Edit your snmpd.conf file (usually /etc/snmp/snmpd.conf) and add:
```
extend phpfpmsp /etc/snmp/phpfpmsp
extend phpfpmsp /etc/snmp/php-fpm
```
4. Edit /etc/snmp/phpfpmsp to include the status URL for the PHP-FPM
pool you are monitoring.
5. Create the config file
`/usr/local/etc/php-fpm_extend.json`. Alternate locations may be
specified using the the `-f` switch. Akin to like below. For more
information, see `/etc/snmp/php-fpm --help`.
```json
{
"pools":{
"thefrog": "https://thefrog/fpm-status",
"foobar": "https://foo.bar/fpm-status"
}
}
```
5. Restart snmpd on your host
It is worth noting that this only monitors a single pool. If you want
to monitor multiple pools, this won't do it.
6. Restart snmpd on the host
The application should be auto-discovered as described at the top of
the page. If it is not, please follow the steps set out under `SNMP