开启status:
[root@localhost conf]# vim nginx.conf
location / {
root html;
index index.html index.htm;
}
location /status {
stub_status;
}
[root@localhost conf]# nginx -s reload
编写脚本
[root@localhost conf]# cat status.sh
#!/bin/bash
if [ `curl -s http://192.168.240.60/status|awk 'NR==4 {print $2}' ` -ne 0 ];then
echo 1
else
echo 0
fi
配置zabbix配置文件
[root@localhost conf]# 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服务端测试
[root@localhost ~]# zabbix_get -s 192.168.240.60 -k check_status 0浏览器配置监控
添加主机
创建监控项
创建触发器
仪表盘查看



