1#!/bin/bash 2LIST=("http://xxxx.com") 3NAME=("评价系统getwindowList接口") 4for ((i=0;i<${#LIST[@]};i++)) 5do 6HTTP_CODE=`curl -o /dev/null -s -w "%{http_code}" "${LIST[$i]}"` 7if [ $HTTP_CODE != '200' ];then 8TIME=$(date "+%Y-%m-%d %H:%M:%S") 9#发送微信公众号 10curl 'http://xxxxx.com' \ 11 -H 'Content-Type: application/json' \ 12 -d "{ 13 \"content\":\"${NAME[$i]}${LIST[$i]}\" 14 }" 15 16#发送钉钉 17curl 'https://oapi.dingtalk.com/robot/send?access_token=xxxxxx' \ 18 -H 'Content-Type: application/json' \ 19 -d "{\"msgtype\": \"markdown\", 20 \"markdown\": { 21 \"title\":\"监控到系统无法正常访问\", 22 \"text\": \"### 监测到系统无法正常访问 \\n 23 - 名称: ${NAME[$i]} 24 - 网站: [${LIST[$i]}](${LIST[$i]}) 25 - 时间: ${TIME} \" 26 }, 27 "isAtAll": true 28 }" 29 30fi 31done
Linux自动检测网站心跳通知shell脚本
Stella981
2021-10-11
1295 0 0
点赞
收藏
评论区
加载中...