赞
踩
for line in `cat switch1.txt` #所有交换机的IP
do
key=`snmpwalk -v 2c -c '$!na&3A' $line .1.3.6.1.4.1.25506.2.6.1.1.1.1.6 | fgrep -c "INTEGER"`
#华三oid值,匹配关键值数量
key2=`snmpwalk -v 2c -c '$!na&3A' $line 1.3.6.1.4.1.9.2.1.56.0 | fgrep -c "INTEGER"`
#思科oid值,匹配关键值数量
echo $key
echo $key2
if [ $key -ge 1 -a $key2 -le 0 ];then
echo "$line is h3c"
echo $line >> h3c41.txt
elif [ $key -le 0 -a $key2 -ge 1 ];then
echo "$line is cisco"
echo $line >> cisco41.txt
else
echo "$line unknown"
echo $line >> others41.txt
fi
done
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。