HomeNginx Monitoring
Nginx Monitoring

Ngnix is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption. It is the another web server for server side scripting like php, & static web sites. Nodelizer helps you to monitor following metric about installed nginx on your server.

Metrics collected by Ngnix Integration
Metric
– Description
Active Connections
– The current number of active client connections including Waiting connections.
Connections Opened / Sec
– The rate of number of accepted client connections.
Connections Dropped / Sec
– The rate of number of dropped connections.
Requests / Sec
– The rate of number of client requests.
Reading Connections
– The current number of connections where nginx is reading the request header.
Writing Connections
– The current number of connections where nginx is writing the response back to the client.
Waiting Connections
– The current number of idle client connections waiting for a request.
Configuring
  1. Make sure HttpStubStatusModule is compiled by typing below command in terminal (check for / with – http_stub_status_module):

    nginx -V 2>&1 | grep -o with-http_stub_status_module

  2. Add the following lines to your /etc/nginx/nginx.conf file[OR /etc/nginx/sites-available/default file] within a server { } block :

    server {

    location /nginx_status {

    # Turn on nginx stats

    stub_status on;

    access_log off;

    # Security: Only allow access from 127.0.0.1 IP #

    allow 127.0.0.1;

    deny all;

    }

    }

    • Replace IP address 127.0.0.1 with your server’s public IP address. This will allow the status to be accessed from the URL http://yourserver:port/nginx_status.
    • For security, status should only be accessed from the server itself.
    • To access status from another IP as well, you also need to add that IP address in allow list. For example :

      • allow 127.0.0.1;
      • allow 127.0.0.2;
  3. Restart the Nginx Web Server after saving changes.
  4. Check in your browser or with curl/wget :

  5. Edit the rptmonitor/config.cfg file:

    • Uncomment the line containing ‘nginx_status_url:‘ & replace your IP & port. For eg. if your IP was 127.0.0.1 and port 80 (– specify the port if default is not 80) then it would be:

    • Provide username(nginx_usrnm) & password(nginx_pswd) if the status URL is protected. Remove # symbol to uncomment the lines.
  6. Restart rptmonitor :

    • For (deb/rpm)package supported Linux distros :

      sudo /etc/init.d/rptmonitor restart
    • For openSUSE(11.4+) with systemd :

      sudo systemctl restart rptmonitor.service
    • For other Linux distro, FreeBSD8+, Mac OS X+ :

      sudo python /usr/local/bin/rptmonitor/monitor.py restart