api

#!/bin/bash
logApi=(91xingcai  xinyao  ag ah ascp)
for i in ${logApi[*]};do
  content=`tail -n 100000  /home/logs/nginx/access/${i}Api.log |grep -v  'upstreamstatus:200' |grep -v 'domain/check' |grep -v 'test-obj' |grep -v 'status:404' |grep -v 'size:0'`
  variable=`tail -n 100000  /home/logs/nginx/access/${i}Api.log |grep -v  'upstreamstatus:200' |grep -v 'domain/check' |grep -v 'test-obj' |grep -v 'status:404'  |grep -v 'size:0' |wc -l`
  if [ $variable -gt  500 ];then
     echo $content >>/opt/200.txt
     curl -X POST "https://api.telegram.org/bot1998667609:AAGwc795pn8kyQWY_hiDeBkgMNAPro9H4MU/sendMessage" -d "chat_id=-724131185&text=${i}Api.logapi-非200超过500-ip$HOSTNAME-$variable"
  else
     echo "good"
  fi
done
posted @ 2022-05-27 17:37  人生信条~~  阅读(83)  评论(0编辑  收藏  举报