Nginx輸出基本狀態信息(Ngx_http_stub_module模塊)
輸出Nginx基本狀態信息(Ngx_http_stub_status_module)
官方文檔:http://nginx.org/en/docs/http/ngx_http_status_module.html
官方定義:
The ngx_http_stub_status_module module provides access to basic status information.
This module is not built by default, it should be enabled with the --with-http_stub_status_module configuration parameter.
註意:此模塊在編譯時啟動,指定--with-http_stub_status_module;
#Example Configuration location /basic_status { stub_status; }
Syntax: | stub_status; |
---|---|
Default: | — |
Context: | server , location |
Context:適用配置段
演示環境:
Server:192.168.47.140 [root@GaoServer ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@GaoServer ~]# uname -r 3.10.0-327.el7.x86_64 [root@GaoServer ~]# nginx -V nginx version: nginx/1.10.2 ......
相關配置:
[root@GaoServer ~]# vim /etc/nginx/conf.d/Vhost.conf server { listen 80; location /status { stub_status; } } #測試 [root@GaoServer ~]# curl http://192.168.47.140/status Active connections: 1 server accepts handled requests 23 23 50 Reading: 0 Writing: 1 Waiting: 0
狀態信息定義:(官方定義)
Active connections: #當前的活動連接數(包括Waiting狀態的連接);
The current number of active client connections including Waiting connections.
accepts: #從Nginx啟動到此時一共已經接收的請求數;
The total number of accepted client connections.
handled: #已經被處理完成的請求;
The total number of handled connections. Generally, the parameter value is the same as acceptsunless some resource limits have been reached (for example, the worker_connections limit).
requests: #客戶端發來的總請求數;
The total number of client requests.
Reading: #Nginx讀取客戶端請求報文的連接數;
The current number of connections where nginx is reading the request header.
Writing: #Nginx處於向客戶端發送響應報文的連接數;
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.
Nginx輸出基本狀態信息(Ngx_http_stub_module模塊)