LibreNMS - snmp extend php-fpm: Difference between revisions
From Wiki.IT-Arts.net
imported>Z No edit summary |
imported>Z No edit summary |
||
Line 22: | Line 22: | ||
<nowiki> | <nowiki> | ||
Debian-snmp ALL=(ALL) NOPASSWD: /etc/snmp/phpfpmsp</nowiki> | Debian-snmp ALL=(ALL) NOPASSWD: /etc/snmp/phpfpmsp</nowiki> | ||
= PHP Configuration = | |||
In ''/etc/php/7.3/fpm/pool.d/www.conf'', uncomment: | |||
<nowiki> | |||
pm.status_path = /status</nowiki> | |||
Restart the service. | |||
= vHOST = | |||
Adapt your config with: | |||
<nowiki> | |||
location ~ ^/(status|ping)$ { | |||
allow 127.0.0.1; | |||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |||
fastcgi_index index.php; | |||
include fastcgi_params; | |||
#fastcgi_pass 127.0.0.1:9000; | |||
fastcgi_pass unix:/var/run/php7.3-fpm.sock; | |||
}</nowiki> | |||
Restart the service. | |||
Test the vhost with: | |||
<nowiki> | |||
curl http://127.0.0.1/status</nowiki> | |||
Line 45: | Line 74: | ||
* https://docs.librenms.org/Extensions/Applications/#php-fpm | * https://docs.librenms.org/Extensions/Applications/#php-fpm | ||
* https://www.tecmint.com/enable-monitor-php-fpm-status-in-nginx/ | |||
---- | ---- |
Revision as of 11:14, 1 May 2020
NginX LibreNMS script
Get the script:
wget https://github.com/librenms/librenms-agent/raw/master/snmp/phpfpmsp -O /etc/snmp/phpfpmsp
Unzip and copy it where you need. Make it executable.
Adapt:
url="http://127.0.0.1/status?full"
sudo Configuration
Adapt your /etc/sudoers with:
Debian-snmp ALL=(ALL) NOPASSWD: /etc/snmp/phpfpmsp
PHP Configuration
In /etc/php/7.3/fpm/pool.d/www.conf, uncomment:
pm.status_path = /status
Restart the service.
vHOST
Adapt your config with:
location ~ ^/(status|ping)$ { allow 127.0.0.1; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; #fastcgi_pass 127.0.0.1:9000; fastcgi_pass unix:/var/run/php7.3-fpm.sock; }
Restart the service.
Test the vhost with:
curl http://127.0.0.1/status
SNMP Configuration
Adapt your /etc/snmp/snmpd.conf with:
extend phpfpmsp /usr/bin/sudo /etc/snmp/phpfpmsp
Restart the service.
Check Command
Adapt the user and path to your configuration:
sudo -u Debian-snmp /etc/snmp/phpfpmsp
Sources
- https://docs.librenms.org/Extensions/Applications/#php-fpm
- https://www.tecmint.com/enable-monitor-php-fpm-status-in-nginx/