shell 告警脚本
shell 告警脚本
功能:执行URL,超过30秒就发邮件进行告警
#!/bin/sh
Path="/root/shell"
MailList="[email protected] [email protected]"
Date=`date '+%Y-%m-%d %H:%M:%S'`
for url in $(cat /home/caozm/moniter/url.txt)
do
Time=`curl -o /dev/null -s -w "time_connect: %{time_connect} time_starttransfer: %{time_starttransfer} time_total: %{time_total}" ${url}`
TimeTotal=`echo $Time | awk -F " " '{print $6}'`
if [ $(echo "$TimeTotal > 30"|bc) == 1 ]
then
{
echo "${Date} ${Time} $url" | mail -s "${url}" ${MailList}
}
fi
相关推荐
huha 2020-10-16
laisean 2020-11-11
大牛牛 2020-10-30
firefaith 2020-10-30
liguojia 2020-10-20
wangzhaotongalex 2020-10-20
以梦为马不负韶华 2020-10-20
JohnYork 2020-10-16
Julyth 2020-10-16
applecarelte 2020-10-16
laisean 2020-09-27
flycappuccino 2020-09-27
liguojia 2020-09-27
wangzhaotongalex 2020-09-22
流年浅滩 2020-10-23
liujianhua 2020-10-22
woaimeinuo 2020-10-21
tufeiax 2020-09-03
laisean 2020-09-01
vvu 2020-09-16
libao 2020-09-16
Yyqingmofeige 2020-08-18
zhushixia 2020-08-17