Configuring LibreNMS Nginx statistics

This post might help me in configuring net-snmp to deliver Nginx statistics to LibreNMS.

As such, this post may not be as helpful to you as the official documentation.

Key is this URL: http://127.0.0.1/nginx-status

The nginx.conf file needs something like this:

server {
  listen 127.0.0.1:80;

  server_name localhost;

  location ~ ^/status$ {
    access_log off;
    allow 127.0.0.1;
    fastcgi_pass unix:/var/run/php-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    include fastcgi_params;
  }

  location /nginx-status {
    access_log off;
    stub_status on;
    allow all;
  }
}

NOTE: the fastcgi_pass line might also be fastcgi_pass 10.80.0.92:9000 depending on what you find in /usr/local/etc/php-fpm.conf.

You should see something like this in the script, which you might have copied from https://github.com/librenms/librenms-agent/blob/master/snmp/nginx

[dan@supernews:/usr/local/etc/snmp] $ grep nginx *
nginx-stats:data = urllib2.urlopen('http://127.0.0.1/nginx-status').read()

I also had this:

$ grep nginx /usr/local/etc/snmpd.conf
extend nginx            /usr/local/etc/snmp/nginx-stats
Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top