Linux自动检测网站心跳通知shell脚本

释放双眼,带上耳机,听听看~!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
32

 

给TA打赏
共{{data.count}}人
人已打赏
安全运维

设计模式之抽象工厂模式

2021-12-12 17:36:11

安全运维

OpenSSH-8.8p1离线升级修复安全漏洞

2022-1-9 9:47:55

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索