nginx qps 监控

2014-11-19 0 677
nginx qps 监控
 1 #/bin/bash
  2 
  3 #nginx_status_url 手动配置项
  4 NGINX_STATUS_URL="http://127.0.0.1/nginx_status"
  5 
  6 #10sec 峰值
  7 MAX=1;
  8 MAILLIST="foyon0806@gmail.com"
  9 
 10 send_warning()
 11 {
 12     echo $MESSAGE | /bin/mail -s "$TITLE" "$MAILLIST"
 13 }
 14 
 15 QPS1=`curl -s ${NGINX_STATUS_URL} | awk '/server accepts handled requests/{getline a;split(a,d);print d[length(d)]}'`
 16 
 17 #10sec
 18 sleep 10
 19 
 20 QPS2=`curl -s ${NGINX_STATUS_URL} | awk '/server accepts handled requests/{getline a;split(a,d);print d[length(d)]}'`
 21 echo $QPS1
 22 echo $QPS2
 23       
 24 QPS=`expr $QPS2 - $QPS1`
 25 DATA=`date`
 26 if [ $QPS -ge $MAX ];then
 27     TITLE="[serious]: ${NGINX_STATUS_URL}"
 28     MESSAGE="Time:${DATA},${NGINX_STATUS_URL} qps per 10 sec more than ${MAX}"
 29     send_warning
 30 fi
 31 exit
~                                                                                                                                                                    
~                        

遇见资源网 shell nginx qps 监控 http://www.ox520.com/16708.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务