码迷,mamicode.com
首页 > Web开发 > 详细

shell telnet 路由器

时间:2014-08-02 20:51:24      阅读:269      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   for   ar   div   amp   log   

#!/usr/bin/expect -f

spawn  telnet 172.16.1.80
expect "login" {
        send   "admin\n"
        expect {
                "Password" { send "admin\n" }
                }
        }

expect ">"  {send "show   interface  all  status\n"}
expect ">"  {send "exit\n"}

expect eof
exit 0

 

#!/bin/sh
up_port="GE1 GE2  GE3 GE4 GE5 GE6 GE7 XGE1 XGE2"
tmp=`../plugin//wk.exp > /tmp/.log.wk`

route_status=`grep Up /tmp/.log.wk`
port=`echo  "$route_status" |awk  -F   {print $1}`

for x  in $up_port
do
        echo $port |grep -w  $x &> /dev/null #||  echo port: $x is down
        if [ $? = 1 ];then
                case $x  in
                    "GE1" )
                        echo "alarm" "critical"  "is" "$x SGSN601 Data interrupt";;
                    "GE2" )
                        echo "alarm" "critical" "is" "$x SGSN602 Data interrupt";;
                    "GE3" )
                        echo "alarm" "critical" "is" "$x SGSN603 Data interrupt";;
                    "GE4" )
                        echo "alarm" "critical" "is" "$x SGSN207 Data interrupt";;
                    "GE5" )
                        echo "alarm" "critical" "is" "$x SGSN501 Data interrupt";;
                    "GE6" )
                        echo "alarm" "critical" "is" "$x SGSN504 Data interrupt";;
                    "GE7" )
                        echo "alarm" "critical" "is" "$x SGSN505 Data interrupt";;
                    "XGE1" )
                        echo "alarm" "critical" "is" "$x SGSN201&202&203 Data interrupt";;
                    "XGE2" )
                        echo "alarm" "critical" "is" "$x Platform collect Data interrupt";;
                esac
        fi
done

 

shell telnet 路由器,布布扣,bubuko.com

shell telnet 路由器

标签:style   blog   color   for   ar   div   amp   log   

原文地址:http://www.cnblogs.com/bokun-wang/p/3887441.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!