Nginx 流量带宽等请求状态统计( ngx_req_status)

时间:2023-03-09 01:47:29
Nginx 流量带宽等请求状态统计( ngx_req_status)
Nginx 流量带宽等请求状态统计
( ngx_req_status)  插件下载地址
wget http://nginx.org/download/nginx-1.4.2.tar.gz
git clone https://github.com/zls0424/ngx_req_status.git
配置示例:
1、服务目录
mkdir /opt/server

2、补丁导入;
patch -p1 < /opt/server/ngx_req_status/write_filter-VERSION.patch
tar -xf http://nginx.org/download/nginx-1.4.2.tar.gz -C /opt/server
cd /opt/server/nginx
./configure --prefix=/opt/server/nginx-1.4. --add-module=/opt/server/ngx_req_status-master
make -j2
  // 处理器的多核作业;
make install
3、nginx http 模块配置; http {
req_status_zone server_name $server_name 256k;
req_status_zone server_addr $server_addr 256k;
req_status_zone server_url $server_name$uri 256k;
req_status server_name server_addr server_url;
server {
lisent ;
server_name localhost;
location /req-status {
req_status_show on;
}
}
}
测试查看 :
curl http://127.0.0.1/req-status
参数:
key路径
max_active 最大连接数
max_bw 最大带宽
traffic 访问量
requests 请求数
active 连接数
bandwidth 网络带宽
 检测:
[root@test nginx-1.4.]# curl http://127.0.0.1/req-status

zone_name key max_active max_bw traffic requests active bandwidth
server_addr 10.10.10.100 31K 3M
server_addr 127.0.0.1 206K
server_name localhost 30K 3M
server_name www.hktest.com 78K
server_url localhost/ 18K
server_url localhost/hktest-status 91K
server_url localhost/favicon.ico
server_url localhost/req-status 206K
server_url localhost/req-status/ 30K 2M
server_url www.hktest.com/hktest-status 78K