Sometimes, we prefer to view statistics in graphical form rather than numerical values, which is not too attractive to be displayed. Nginx supports stub_status directive module, which we can use to print:
- Active connections
- Server accepts handled requests
- Reading
- Writing
- Waiting
For example:
Active connections: 6 server accepts handled requests 15561 15561 26602 Reading: 4 Writing: 2 Waiting: 0
However, This module is not compiled by default and must be specified using this argument when compiling nginx.
--with-http_stub_status_module
First, to get statistics like the above example, you should modify nginx config file and add location directive this
server {
....
....
location /nginx_status {
stub_status on;
access_log off;
allow 1.2.3.4;
allow 5.6.7.8;
deny all;
}
}
perl scripts used to generate statistical images can be downloaded here:
http://kovyrin.net/files/mrtg/rrd_nginx.pl.txt
Rename rrd_nginx.pl.txt to rrd_nginx.pl and make it executable
Continue reading »
Follow me on Twitter