./ips 1,2 | awk '{ print "./dell-switch.pl "$1" \"copy startup-config tftp://10.20.0.253/backups/"$2".config\"" }' | NO_LOG=1 sh -x
+
+To use snmp* utils, create snmp.conf with:
+
+COMMUNITY=my-comminity-or-public
-#!/bin/bash
-cat dell | while read line
+#!/bin/bash -e
+
+. snmp.conf # get COMMUNITY
+
+log=/dev/shm/sw.mac.port
+test -d $log && mv $log $log.last
+mkdir $log
+
+./ips | while read ip
do
- snmpwalk -v 2c -c XXXXXXXXXXXXXXXXXXX $line 1.3.6.1.2.1.17.4.3.1.2 | sed 's/iso.3.6.1.2.1.17.4.3.1.2./ /g' | awk '{print $1" .g"$4}' | awk -v sw="$line" -F '.' '{ printf "%02X:%02X:%02X:%02X:%02X:%02X,%s,%s\n", $1, $2, $3, $4, $5, $6, $7, sw }'
+ snmpwalk -v 2c -c $COMMUNITY $ip 1.3.6.1.2.1.17.4.3.1.2 2>>/dev/shm/sw.errors | sed 's/iso.3.6.1.2.1.17.4.3.1.2./ /g' | awk '{print $1" .g"$4}' | awk -v sw="$ip" -F '.' '{ printf "%02X:%02X:%02X:%02X:%02X:%02X,%s,%s\n", $1, $2, $3, $4, $5, $6, $7, sw }' | tee $log/$ip
done