1.Background
The Ngx_http_stub_status_module is an nginx built-in HTTP module that provides status information for Nginx. This module is not compiled by default, so it is necessary to specify the module to be loaded when compiling Nginx:
--with-http_stub_status_module
Of course, if you are recompiling, just-s reload is not enough and may require a smooth upgrade: Research on the configuration and deployment of high performance Web server Nginx (14) Smooth upgrade your nginx.
Why do you take it as an example? Because it is also a short enough module, is a typical handler module. Then we will explain the module process, are:
1). A Brief introduction
2). The instance used
3). Instruction Introduction
4). Source Code Analysis
2.Simple Example
Location/Nginx_status { #copied from http://blog.kovyrin.net/2006/04/29/ monitoring-nginx-with-rrdtool/ stub_status on; Access_log off; Allow SOME. Ip. ADD. RESS; Deny all;}
We assume that you are experimenting on this machine and that you are opening port 80, then enter in the browser: Http://localhost/nginx_status will see this message:
291 server accepts handled requests 16630948 16630948 31070465 6179106
Its meaning is easy to understand:
First line
current number of active connections : 291 #个人认为是处于 SYN_RCVD, established status, equals Reading + Writing + waiting
Second line
the number of connections accepted by the server : 16630948 (accepted connection #), the number of connections received from the client, and the number of connections received by the worker process.
the number of connections that the server has processed : 16630948 (handled connection #), the total number of connections that have been processed, whose values are generally equal to accepts, unless some resources are limited, such as: Set Worker_ The number of connections is limited.
requests processed by the server : 31070465 (can be calculated, average 1.8 requests per connection) (Handled connection #)
Third line
Reading–nginx The number of connections that are reading the request header is 6;
The Writting–nginx is reading the request body, processing the request, and sending a response to the client with a number of 179 connections;
waiting– The number of long connections currently active : 106. #只是keep-alive, there is no active connection.
Nginx official explanation is as follows:
Active connections–number of all open connections
Server accepts handled Requests–nginx accepted 16630948 connections, handled 16630948 connections (no one was closed jus T it was accepted), and handles 31070465 requests (1.8 requests per connection)
Reading–nginx Reads request header
Writing–nginx reads request body, processes request, or writes response to a client
Waiting–keep-alive connections, actually it is active-(reading + writing)
3 directives
The only instruction in this module is:
Stub_status
Syntax: Stub_status on
Scope: Location
Function: Statistics The location of the information.
Transferred from: http://blog.csdn.net/poechant/article/details/7627843
nginx-interpreting built-in non-default modules Ngx_http_stub_status_module