zabbix监控nginx status
zabbix监控nginx status
开启状态界面
开启status:
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
location / {
root html;
index index.html index.htm;
}
location /status {
stub_status;
}
[root@localhost ~]# nginx -s reload
编写脚本
[root@localhost scripts]# vim status.sh
#!/bin/bash
if [ `curl -s http://192.168.10.201/status|awk 'NR==4 {print $2}' ` -ne 0 ];then
echo 1
else
echo 0
fi
配置zabbix配置文件
[root@localhost ~]# vim /usr/local/etc/zabbix_agentd.conf
# Default: SOMAXCONN (hard-coded constant, depends on system)
# ListenBacklog=
UserParameter=check_status[*],/usr/local/nginx/conf/status.sh
浏览器配置监控
手动触发
|