监控nginx状态shell脚本
本脚本通过nginx的http_stub_status模块来监控nginx的状态,建议与zabbix配合来达到高性能实时监控
#!/bin/bash
case $1 in
reading)
curl -s 192.168.2.100/status | awk 'NR==4{print $2}'
;;
active)
curl -s 192.168.2.100/status | awk 'NR==1{print $3}'
;;
server)
curl -s 192.168.2.100/status | awk 'NR==3{print $1}'
;;
writing)
curl -s 192.168.2.100/status | awk 'NR==4{print $4}'
;;
waiting)
curl -s 192.168.2.100/status | awk 'NR==4{print $6}'
;;
*)
echo "请输入(reading|active|server|writing|waiting)"
;;
esac