//脚本
[root@slave ~]# cd /scripts/
[root@slave scripts]# ls
notify.sh Waiting.sh
Reading.sh Writing.sh
[root@slave scripts]# cat Reading.sh
#/bin/bash
if [ `curl -s 192.168.72.138/status|grep Waiting|awk '{print $2}'` -ne 0 ]
then
echo "0"
else
echo "1"
fi
[root@slave scripts]# cat Writing.sh
#/bin/bash
if [ `curl -s 192.168.72.138/status|grep Waiting|awk '{print $4}'` -ne 0 ]
then
echo "0"
else
echo "1"
fi
[root@slave scripts]# cat Waiting.sh
#/bin/bash
//nginx配置
[root@slave scripts]# vim /usr/local/nginx/conf/nginx.conf
if [ `curl -s 192.168.72.138/status|grep Waiting|awk '{print $2}'` -ne 0 ]
then
echo "0"
else
echo "1"
fi
[root@slave scripts]#
location /status {
stub_status;
allow 192.168.72.131;
deny all;
}
[root@slave scripts]# nginx -s reload
配置监控项
配置触发器
[root@master etc]# curl -s 192.168.72.138/status
Active connections: 1
server accepts handled requests
1635 1635 122
Reading: 0 Writing: 1 Waiting: 0
[root@master etc]#