Hunter的大杂烩

December 22, 2010

遍历设备OID的脚本

Filed under: 技术话题 — hunter @ 2:59 pm

#!/bin/sh

OLDOID=””
NEWOID=”0″

count=0
while [ “$OLDOID” != “$NEWOID” ];
do
        OLDOID=$NEWOID
        bin/snmpgetnext -O s -v 2c -c public 192.168.0.1 $OLDOID
        NEWOID=`bin/snmpgetnext -O s -v 2c -c public 192.168.0.1 $OLDOID|awk ‘{print $1}’`
        echo $NEWOID
        count=`expr $count + 1`
        if [ $count -gt 10 ];then
                count=0
                sleep 1
        fi
done

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress