nginx监控指标
- ngx_http_stub_status_module:http://nginx.org/en/docs/http/ngx_http_stub_status_module.html
- 用nginx-rrd监控nginx访问数:http://laoxu.blog.51cto.com/4120547/1159491
ngx_http_stub_status_module模块能够获取Nginx自上次启动以来的工作状态。
此模块非核心模块,需要在编译的时候手动添加编译参数--with-http_stub_status_module
。
配置说明
-
nginx配置
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; }
语法: stub_status on 默认值: None 作用域: location 创建一个 location 区域启用 stub_status
输出内容
"stub status" 模块返回的状态信息下:
Active connections: 291 server accepts handled requests 16630948 16630948 31070465 Reading: 6 Writing: 179 Waiting: 106
-
Active connections
- 当前连接数(包括Waiting状态的连接)。
- The current number of active client connections including Waiting connections.
-
server accepts handled requests
-
accepts
:nginx 总共处理了 16630948 个连接(The total number of accepted client connections)。 -
handled
:成功创建 16630948 次握手(证明中间没有失败的)。The total number of handled connections. Generally, the parameter value is the same as accepts unless some resource limits have been reached (for example, the worker_connections limit). -
requests
:总共处理了 31070465 个请求 (平均每次握手处理了1.8个数据请求)。The total number of client requests.
-
-
reading
-- The current number of connections where nginx is reading the request header. -
writing
-- The current number of connections where nginx is writing the response back to the client. -
waiting
-- The current number of idle client connections waiting for a request. 开启 keep-alive 的情况下,waiting = active - reading - writing
。