X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=sidebyside;f=sw-snmpbulkwalk.sh;h=7d27c63a2c9af75fbe3e5ece8b520fd70c6fe27a;hb=HEAD;hp=aed79b4e840515be1fb06e5b77cc6ced09a44bb6;hpb=778a3f252b5d976468c4cd0c0f7b1f2b057dac11;p=dell-switch diff --git a/sw-snmpbulkwalk.sh b/sw-snmpbulkwalk.sh index aed79b4..7d27c63 100755 --- a/sw-snmpbulkwalk.sh +++ b/sw-snmpbulkwalk.sh @@ -1,4 +1,21 @@ -mkdir /dev/shm/snmpbulkwalk/ +#!/bin/sh -e -./sw-names | xargs -i echo "snmpbulkwalk -OX -v2c -Cc -c $COMMUNITY {} | tee /dev/shm/snmpbulkwalk/{}" | parallel +# Usage: $0 [sw [oid]] + +dir=/dev/shm/snmpbulkwalk/ +if [ ! -d $dir ] ; then + mkdir $dir + ln -sv `pwd`/snmpbulkwalk/.git $dir/ +fi + +. ./snmp.conf + +ext="" +if [ ! -z "$2" ] ; then + ext=".$2/" + test ! -d "$dir/$ext" && mkdir "$dir/$ext" +fi + +( test ! -z "$1" && echo $1 || ./sw-names ) | xargs -i sh -c \ +"snmpbulkwalk -OX -v2c -Cc -c $COMMUNITY {} $2 | tee $dir/$ext{} && test -z "$ext" && cd $dir && git add $dir/$ext{} && git commit -m {} $dir/$ext{}" #| parallel