添加nginx监控项
./configure --prefix=/usr/local/nginx --with-http_stub_status_module #编译时加入该模块
[root@server2 nginx-1.15.8]# make && make install
[root@server2 nginx-1.15.8]# vim /usr/local/nginx/conf/nginx.conf
48 location /status {
49 stub_status on; # Nginx中的stub_status模块主要用于查看Nginx的一些状态信息. 本模块默认是不会编译进Nginx的,如果你要使用该模块,则要在编译安装Nginx时指定:./configure –with-http_stub_status_module
50 access_log off; # 关闭日志记录
51 allow 127.0.0.1; # 只允许本机访问
52 deny all;
53 }
#进行语法检测
[root@server2 nginx-1.15.8]# /usr/local/nginx/sbin/nginx -t
#开启nginx
[root@server2 nginx-1.15.8]# /usr/local/nginx/sbin/nginx
[root@server2 nginx-1.15.8]# ab -c 1 -n 1000 http://127.0.0.1/status
[root@server2 nginx-1.15.8]# curl http://127.0.0.1/status
Active connections: 1
server accepts handled requests
1006 1006 1006
Reading: 0 Writing: 1 Waiting: 0
#过滤监控参数(访问次数,连接次数等等)
[root@server2 nginx-1.15.8]# curl -s http://127.0.0.1/status | grep Active | awk '{print $3}'
1
[root@server2 nginx-1.15.8]# curl -s http://127.0.0.1/status | awk NR==3 | awk '{print $1}'
1007
- 创建nginx监控项(nginx.active和nginx.access)
[root@server2 nginx-1.15.8]# cd /etc/zabbix/zabbix_agentd.d/
[root@server2 zabbix_agentd.d]# vim userparameter_nginx.conf
UserParameter&#