#/bin/bash
#key1=`cat /data/switch/script/gs/data/10.252.1.252-1 |grep B |awk -F . '{print $1}'`
#key2=`cat /data/switch/script/gs/data/10.252.1.252-2 |grep B |awk -F . '{print $1}'`
#num1=`cat -n /data/switch/script/gs/data/10.252.1.252-1 |grep B|awk '{print $1}'`
#num2=`cat -n /data/switch/script/gs/data/10.252.1.252-2 |grep B|awk '{print $1}'`
for i in `cat -n /data/switch/script/gs/data/10.252.1.252-1 |grep B|awk '{print $1}'`
do
for j in `cat -n /data/switch/script/gs/data/10.252.1.252-2 |grep B|awk '{print $1}'`
do
if [ $i -eq $j ];then
key1=`sed -n ''$i'p' /data/switch/script/gs/data/10.252.1.252-1 |awk -F . '{print $1}'`
key2=`sed -n ''$i'p' /data/switch/script/gs/data/10.252.1.252-2 |awk -F . '{print $1}'`
dkey=$(expr $key2 - $key1)
#echo $dkey
if [[ $dkey -gt 2 || $dkey -lt -2 ]];then
yu=$(($i%3))
if [ $yu = 2 ];then
interface1=`cat -n /data/switch/script/gs/data/10.252.1.252-1 |grep $(($i-1)) |awk '{print $2}'`
/usr/bin/curl -s -d "biz_type=net_warn" -d "mobile=" --data-urlencode "content=$ipaddr $interface1 is warning dkey > 3dBm" "http://192.168.7.175:8080/notify/sms/send_warn_sms"
#echo `cat -n /data/switch/script/gs/data/10.252.1.252-1 |grep $(($i-1)) |awk '{print $2}'`
else
interface2=`cat -n /data/switch/script/gs/data/10.252.1.252-1 |grep $(($i-2)) |awk '{print $2}'`
/usr/bin/curl -s -d "biz_type=net_warn" -d "mobile=" --data-urlencode "content=$ipaddr $interface2 is warning dkey > 3dBm" "http://192.168.7.175:8080/notify/sms/send_warn_sms"
#echo `cat -n /data/switch/script/gs/data/10.252.1.252-1 |grep $(($i-2)) |awk '{print $2}'`
fi
#echo $yu
#echo $dkey
#echo $key2
fi
fi
done
done
#for key in `cat /data/switch/script/gs/data/10.252.1.252-1 |grep B |awk -F . '{print $1}'`
#do
#dkey=$(echo $key+9|bc)
#if [ 0 -gt $dkey ];then
# echo "$dkey"
# else
# echo "ok"
#fi
#done
#i=`cat /data/switch/script/gs/data/10.252.1.252-1 |grep B |awk -F . '{print $1}'`