NGiNX Plugin

This plugin monitors the NGiNX web server.

Reported Metrics

  • Requests per second
  • Accepts per second
  • Handled per second
  • Total requests
  • Active connections
  • Writing
  • Waiting
  • Reading

Dependencies

  • urllib2
  • nginx compiled with the --with-http_stub_status_module parameter

Enable the NGiNX status page

To enable the NGiNX status page, add the following code to your NGiNX site-enabled configuration file:

server 
	{
  	listen 127.0.0.1:8080;
    server_name localhost;
    location /status_page 
    {
     	stub_status on;
      allow 127.0.0.1;
      deny all;
    }
  }

The status page will only be available from the machine running NGiNX. If you have something else running on port 8080, feel free to change this to an available port.

You can test if the status page is working by running the following command:

wget -qO- http://127.0.0.1:8080/status_page 

Configure the plugin

To enable the plugin, edit the /etc/agent360-custom.ini file and add the following lines:

[nginx]
  enabled = yes
  status_page_url = http://127.0.0.1:8080/status_page

Test the plugin

Test to see if the plugin is working by running the agent360 --test nginx command.
It should show the following metrics:

nginx:
{
  "accepts": 505768,
  "accepts_per_second": 0,
  "active_connections": 198,
  "handled": 505768,
  "handled_per_second": 0,
  "reading": 0,
  "requests": 8335225,
  "requests_per_second": 0,
  "waiting": 196,
  "writing": 2
}

Now you can restart the agent with the service agent360 restart command.