nginx更多信息监控


    ngx_req_status用来展现nginx请求状态信息,相似于apache的status,nginx自带的模块只能显示链接数等等信息,咱们并不能知道到底有哪些请求、以及各url域名所消耗的带宽是多少。ngx_req_status提供了这些功能.css


其功能特性:html

(1)按域名、url、ip等等统计信息nginx

(2)统计总流量apache

(3)统计当前带宽\峰值带宽api

(4)统计总请求数量测试


安装:整个过程官网上也描述的比较清楚了。ui

wget "http://nginx.org/download/nginx-1.3.5.tar.gz"
tar -xzvf nginx-1.3.5.tar.gz
cd nginx-1.3.5/

patch -p1 < /path/to/ngx_req_status/write_filter-VERSION.patch

./configure --prefix=/usr/local/nginx \
            --add-module=/path/to/ngx_req_status

make -j2
make install


可是实际安装过程当中 始终没法编译经过,试了好几个版本,同时也在不一样机器环境上作了测试可是都报了相同的错误。url

../ngx_req_status//ngx_http_req_status_module.c: In function ?.gx_http_req_status_handler?.spa

../ngx_req_status//ngx_http_req_status_module.c:306:41: error: variable ?.p?.set but not used [-Werror=unused-but-set-variable]code

cc1: all warnings being treated as errors

make[1]: *** [objs/addon/ngx_req_status/ngx_http_req_status_module.o] Error 1

make[1]: Leaving directory `/usr/local/src/nginx-1.4.2'

make: *** [build] Error 2


最终经过万能百度的帮助解决了:

修改 objs/Makefile  去除文件中的 -Werror


从新编译 OK



配置nginx.conf

启用ngx_req_status

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 {

 server_name localhost;

 location /req-status {

 req_status_show on;

 }

 }

 }


测试:

zone_name	key	max_active	max_bw	traffic	requests	active	bandwidth
server_addr	172.16.25.197	99	12M	195M	3243	2	266K
server_name	localhost	99	12M	195M	3243	2	266K
server_url	localhost/	1	55K	437K	7	0	 0
server_url	localhost/50x.html	1	 0	293K	14	0	 0
server_url	localhost/aggregators	1	 9760	75K	7	0	 0
server_url	localhost/api/put	2	565K	14M	1321	0	34K
server_url	localhost/api/query	99	244K	21M	471	0	 0
server_url	localhost/api/uid/tsmeta	3	4M	77M	1142	0	18K
server_url	localhost/favicon.ico	1	268K	5M	86	0	65K
server_url	localhost/nginx_status	1	 0	71K	6	0	 0
server_url	localhost/req-status	2	341K	7M	152	2	122K
server_url	localhost/s/D8B88BDFA9330E29B3DF79564AD522C2.cache.html	1	5M	30M	3	0	 0
server_url	localhost/s/E1458A159371228D537FF6556C2AF8CE.cache.html	1	3M	30M	3	0	 0
server_url	localhost/s/gwt/standard/images/corner.png	1	55K	376K	6	0	 0
server_url	localhost/s/gwt/standard/images/hborder.png	1	66K	444K	6	0	 0
server_url	localhost/s/gwt/standard/images/vborder.png	1	11K	90K	6	0	 0
server_url	localhost/s/gwt/standard/standard.css	1	1M	7M	6	0	 0
server_url	localhost/s/queryui.nocache.js	1	250K	2M	7	0	 0
相关文章
相关标签/搜索