幽灵资源网 Design By www.bzswh.com
复制代码 代码如下:
#!/bin/bash
ping_monitor()
{
host_=(203 204 205 207 208 209 210 212 213 214 215 216 217 218 219 220 221)
ping_count=3
called=(13000000001 13000000002 13000000003)
calling=13000000000
callop=1310000000
#main------------------------------------------------------------
echo "`date "+%Y%m%d %H:%M:%S"`----->脚本开始执行......"ping_log
for host_1 in ${host_[*]};do
host=192.168.1.$host_1
echo "-------->开始检测$host服务器通迅是否正常,ping次数$count"
ping_result=`ping $host -c $ping_count |tail -2 |head -1`
#sleep 1
echo "-------->服务器$host检测已完成"
#取成功条数
succ_ping=`echo ${ping_result:23:1}`
#取失败百分比
loss_ping=`echo ${ping_result:46:4}`
if [ $succ_ping -eq $ping_count ];then
echo "本次检测结果---->$host服务器ping检测正常"
echo "`date "+%Y%m%d %H:%M:%S"`--->$host服务器ping检测正常" ping_log
else
echo "本次检测结果---->$host服务器有丢包现象,丢包率为:$loss_ping"
echo "`date "+%Y%m%d %H:%M:%S"`--->$host服务器有丢包现象,丢包率为:$loss_ping" ping_err_log
#插入短信表—smssend00
for called in ${telno[*]};do
mysql -h$dbhost -u$dbuser -p$dbpass -D$dbbase <<GETRECODE
INSERT INTO $dbtable (servercode,smsservercode,groupid,priority,calling,called,payer,orderdatetime,senddatetime,effectstarttime,
effectendtime,effectstarttime2,effectendtime2,invaliddatetime,feevalue,iffee,message,hideflag,msgtype,smsfeetype,ifsmsreport,service
type,morelatetomtflag,reserve,optempid,optuserid,clientprogramtype,optcode,optip,remark)
VALUES
(2,2,1,0,'$calling','$called','$callop',Now(),Now(),'00:00:00','23:59:59',NULL,NULL,NULL,0,1,'服务器告警!!$host服务器检测到有丢包现像,丢包率:$loss_ping',0,1,2,0,'2_2',NULL,NULL,1,668,1,3001,'192.168.1.182',NULL)
GETRECODE
done
fi
done
echo "`date "+%Y%m%d %H:%M:%S"`----->脚本运行完毕......"ping_log
}
#!/bin/bash
ping_monitor()
{
host_=(203 204 205 207 208 209 210 212 213 214 215 216 217 218 219 220 221)
ping_count=3
called=(13000000001 13000000002 13000000003)
calling=13000000000
callop=1310000000
#main------------------------------------------------------------
echo "`date "+%Y%m%d %H:%M:%S"`----->脚本开始执行......"ping_log
for host_1 in ${host_[*]};do
host=192.168.1.$host_1
echo "-------->开始检测$host服务器通迅是否正常,ping次数$count"
ping_result=`ping $host -c $ping_count |tail -2 |head -1`
#sleep 1
echo "-------->服务器$host检测已完成"
#取成功条数
succ_ping=`echo ${ping_result:23:1}`
#取失败百分比
loss_ping=`echo ${ping_result:46:4}`
if [ $succ_ping -eq $ping_count ];then
echo "本次检测结果---->$host服务器ping检测正常"
echo "`date "+%Y%m%d %H:%M:%S"`--->$host服务器ping检测正常" ping_log
else
echo "本次检测结果---->$host服务器有丢包现象,丢包率为:$loss_ping"
echo "`date "+%Y%m%d %H:%M:%S"`--->$host服务器有丢包现象,丢包率为:$loss_ping" ping_err_log
#插入短信表—smssend00
for called in ${telno[*]};do
mysql -h$dbhost -u$dbuser -p$dbpass -D$dbbase <<GETRECODE
INSERT INTO $dbtable (servercode,smsservercode,groupid,priority,calling,called,payer,orderdatetime,senddatetime,effectstarttime,
effectendtime,effectstarttime2,effectendtime2,invaliddatetime,feevalue,iffee,message,hideflag,msgtype,smsfeetype,ifsmsreport,service
type,morelatetomtflag,reserve,optempid,optuserid,clientprogramtype,optcode,optip,remark)
VALUES
(2,2,1,0,'$calling','$called','$callop',Now(),Now(),'00:00:00','23:59:59',NULL,NULL,NULL,0,1,'服务器告警!!$host服务器检测到有丢包现像,丢包率:$loss_ping',0,1,2,0,'2_2',NULL,NULL,1,668,1,3001,'192.168.1.182',NULL)
GETRECODE
done
fi
done
echo "`date "+%Y%m%d %H:%M:%S"`----->脚本运行完毕......"ping_log
}
标签:
ping检测告警
幽灵资源网 Design By www.bzswh.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
幽灵资源网 Design By www.bzswh.com
暂无评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。