zabbix监控nginx,mysql(web界面配置)

本文介绍了如何在Zabbix中添加Nginx监控项,包括在Zabbix server上测试数据获取,并通过Web界面创建监控项。同时,文章还涉及了对MySQL服务的监控,提到了使用Zabbix自带模板的不足,并引入了Percona开源MySQL分析工具的监控模板,包括安装和测试过程。
摘要由CSDN通过智能技术生成

添加nginx监控项

  • 实验前先在agent端部署好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
  • 测试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&#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值