Monitoring NGiNX
Metrics
The following metrics are submitted to Nixstats.
Requests per second
Accepts per second
Handled per second
Total requests
Active connections
Writing
Waiting
Reading
Dependencies
urllib2
nginx compiled with --with-http_stub_status_module parameter
Stub status page
To enable the nginx stub 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
wget -qO- http://127.0.0.1:8080/status_page
Configure the plugin
To enable the plugin edit the nixstats configuration file. This file is usually located at /etc/nixstats.ini.
Add the following settings to the end of the file.
[nginx]
enabled = yes
status_page_url = http://127.0.0.1:8080/status_page
Test to see if the plugin is working by running nixstatsagent --test nginx. It should show the following metrics:
nginx:
{
"accepts": 505768,
"accepts_per_second": 0.0,
"active_connections": 198,
"handled": 505768,
"handled_per_second": 0.0,
"reading": 0,
"requests": 8335225,
"requests_per_second": 0.0,
"waiting": 196,
"writing": 2
}
Now you can restart the agent service nixstatsagent restart to start monitoring NGiNX.
Updated on: 11/09/2018
Thank you!