shell脚本监控阿里云专线网络状态,若不统统过触发阿里云的进程监控报警

#!/bin/bash

while [ 1 ]
  
do

   rtt=`ping -c 3 15.0.160.18 |grep rtt |awk '{print $4}' |awk -F'/' '{print $2}'`
   rtt=${rtt:-'0'}
   echo  $rtt >> /tmp/jianhang_tunnel_monitor.log

   if [ $rtt -eq 0  ];then
      ps -fe|grep tunnel|grep -v grep|awk '{print $2}'|xargs kill -9
      echo "jianhang tunnel is not stable " >> /tmp/jianhang_tunnel_monitor.log

   fi
   sleep 60

done

  

若专线对端ping 的延时 rtt 为0 , 脚本自动kill 掉本身的 montior进程, 经过阿里云的云监控进程监控来触发报警  html

阿里云云监控  进程监控 文档  http://www.javashuo.com/article/p-shznrfkw-hz.htmlbash

相关文章
相关标签/搜索