Difference between revisions of "LibreNMS - snmp extend nginx"

From wiki.1001solutions.net
Line 14: Line 14:
 
  <nowiki>
 
  <nowiki>
 
data = urlopen('http://127.0.0.1/nginx_status').read()</nowiki>
 
data = urlopen('http://127.0.0.1/nginx_status').read()</nowiki>
'''Be careful, 'localhost' seems bugging...'''
+
'''Be careful, 'localhost' seems bugging, use 127.0.0.1 instead...'''
  
  

Revision as of 11:47, 1 May 2020



NginX LibreNMS script

Get the script:

wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/nginx -O /etc/snmp/nginx

Unzip and copy it where you need. Make it executable.

Adapt the url in the script to your configuration, eg:

data = urlopen('http://127.0.0.1/nginx_status').read()

Be careful, 'localhost' seems bugging, use 127.0.0.1 instead...


vHOST

Adapt your config with:

server {
                listen 127.0.0.1:80;
                server_name 127.0.0.1;

                location /nginx_status {
                        stub_status on;
			access_log   off;
			allow 127.0.0.1;
			allow ::1;
			deny all;
                }
}


Sources