don't commit specific OID dumps
[dell-switch] / sw-snmpbulkwalk.sh
1 #!/bin/sh -e
2
3 # Usage: $0 [sw [oid]]
4
5 dir=/dev/shm/snmpbulkwalk/
6 test ! -d $dir && mkdir $dir
7
8 . ./snmp.conf
9
10 ext=""
11 if [ ! -z "$2" ] ; then
12         ext=".$2/"
13         test ! -d "$dir/$ext" && mkdir "$dir/$ext"
14 fi
15
16 ( test ! -z "$1" && echo $1 || ./sw-names ) | xargs -i sh -c \
17 "snmpbulkwalk -OX -v2c -Cc -c $COMMUNITY {} $2 | tee $dir/$ext{} && test -z "$ext" && cd $dir && git add $dir/$ext{} && git commit -m $2 $dir/$ext{}" #| parallel 
18