1.企业微信群机器人
#!/bin/bash while true do for i in `cat services_list` do http_code=`curl -I -o /dev/null -m 2 -s -w %{http_code} $i` if [[ $http_code -ne 200 && $http_code -ne 302 ]] then date echo "$i is down" curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=34ni6935-9m1a-4shi9-a3321-dc2sbd4766c4' -H 'Content-Type: application/json' -d ' { "msgtype": "markdown", "markdown": { "content": "<font color="warning">'$i'</font>服务状态返回异常,请快速检查!!" } }' fi done sleep 30 done ~ ~ ~