标签归档:Nginx Status

Scripts and templates for nginx

Nginx – http://nginx.net/

Provide graphing nginx clients statistics (active, reading, writing, waiting) and nginx socket statistics (accepts, handled, requests). It’s a formal devision used only for graphs usability.

For use do next steps:

1. Enable nginx http_stub_status_module at configure stage (if requared).

2. Enable stub status. Add to nginx.conf (in any server context):
location /nginx_status {
stub_status on;
# disable access_log if requared
access_log off;
#allow XX.YY.AA.ZZ;
#allow YY.ZZ.JJ.CC;
#deny all;
}

Restart nginx. 继续阅读

Monitor the statistics of Nginx with Cacti

First, add the next lines to configuration file of nginx

 location /server_status {
    stub_status on;
    access_log off;
    # Only me can access this
    #allow 10.0.0.12;
    #deny all;
 }

Run nginx -t to make sure the configuration file is correct. Then run kill -1 nginx_pid, nginx will reload the configuration. After nginx reload it, try to access the url: http://server/server_status/, the browser will display like this:

 Active connections: 303 
 server accepts handled requests
  6314384 6314384 34931986 
 Reading: 3 Writing: 5 Waiting: 295

Next, create the script to get the status data from the nginx server. I wrote a python tool to get these data. 继续阅读

HowTo: Enable Nginx Status Page

Apache has status page that can provide data about Apache. How do I enable and display such page using nginx server? How do I enable nginx status page on Linux or Unix-like operating systems?

Like Aapache (httpd), nginx has status page to give you information about Nginx’s server health including Active connections and other data. You can use this info to fine tune your server. Please note that you will get stats for entire Nginx server running. This can not be used to get info per virtual host i.e. you will get data for entire Nginx server only. 继续阅读