filter log/ filenames into sw.command
[dell-switch] / sw-topology-snmpbulkget.sh
index 490fb7a..c91cc23 100755 (executable)
@@ -3,20 +3,22 @@
 # Usage: $0 [sw [oid]]
 
 dir=/dev/shm/snmp-topology/
-test ! -d $dir && mkdir $dir
+if [ ! -d $dir ] ; then
+       mkdir $dir
+       ln -sv `pwd`/snmp-topology/.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 echo \
-"test ! -e $dir/{} && " \
-"snmpbulkwalk -OX -v2c -Cc -c $COMMUNITY {} IF-MIB::ifPhysAddress        | tee -a $dir/{}     && "\
-"snmpbulkwalk -OX -v2c -Cc -c $COMMUNITY {} Q-BRIDGE-MIB::dot1qTpFdbPort | tee -a $dir/$ext{} || "\
-"snmpbulkwalk -OX -v2c -Cc -c $COMMUNITY {} BRIDGE-MIB::dot1dTpFdbPort   | tee -a $dir/{} " | sh -x
+"snmpbulkwalk -OX -v2c -Cc -c $COMMUNITY {} Q-BRIDGE-MIB::dot1qTpFdbPort > $dir/{} ; "\
+'test `cat '$dir'/{} | wc -l` -le 1 && ' \
+"snmpbulkwalk -OX -v2c -Cc -c $COMMUNITY {} BRIDGE-MIB::dot1dTpFdbPort   >> $dir/{} ; " \
+"snmpbulkwalk -OX -v2c -Cc -c $COMMUNITY {} IF-MIB::ifPhysAddress        >> $dir/{} "\
+| tee /dev/shm/snmp-topology-snmpbulkwalk.sh | sh -x
+
 
+# ./wap-mac-list.sh
+./snmp-topology.pl
 
+dot -Tsvg -o /var/www/snmp-topology-2.svg /tmp/snmp-topology.dot