
- zabbix自定义监控nginx状态
- 1. 开启状态界面
- 2. 写监控脚本
- 3. 配置监控项
- 4. 配置触发器
- 5. 测试
开启status:
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
location /status {
stub_status on;
allow 192.168.200.146;
allow 192.168.200.145
deny all;
}
[root@localhost ~]# nginx -s reload
状态页面信息详解:
[root@localhost scripts]# vim check_status.sh
#! /bin/bash
ip=$(ip a | grep 'inet ' | grep -v '127.0.0.1' | awk -F'[ /]+' '{print }')
case in
"Reading")
curl -s http://$ip | awk 'NR==4 {print }';;
"Writing")
curl -s http://$ip | awk 'NR==4 {print }';;
"Waiting")
curl -s http://$ip | awk 'NR==4 {print }'
esac
//添加配置文件
[root@localhost scripts]# vim /usr/local/etc/zabbix_agentd.conf
UnsafeUserParameters=1
UserParameter=check_status[*],/bin/bash /scripts/check_Reading.sh
[root@localhost scripts]# pkill zabbix_agentd
[root@localhost scripts]# zabbix_agentd
//测试
[root@zabbix ~]# zabbix_get -s 192.168.200.146 -k check_status Waiting
1
3. 配置监控项
4. 配置触发器
5. 测试
[root@localhost scripts]# ab -n 1500000 http://192.168.200.146/status
以上就是zabbix自定义监控nginx状态实现过程的详细内容,更多关于zabbix自定义监控nginx的资料请关注脚本之家其它相关文章!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)