Package: arpwatch
Version: 2.1a13-2

The arpfetch shell script included with the arpwatch package needed a
few tweaks before I could get it to work. Here are my changes in diff
format :-

--- /usr/sbin/arpfetch  2004-09-15 14:55:10.000000000 +0100
+++ /usr/sbin/arpfetch2 2007-01-10 14:10:39.000000000 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# arpfetch - collect arp data from a cisco using snmpwalk
+# arpfetch - collect arp data from a switch using snmpwalk
 #
 if test $# -ne 2; then
        echo "usage: $0 host cname"
@@ -11,29 +11,28 @@
 cname=$2
 temp=`tempfile -p arpft -s .temp.tmp`
 errs=`tempfile -p arpft -s .errs.tmp`
-what="ip.ipnettomediatable.ipnettomediaentry.ipnettomediaphysaddress"
+oid="1.3.6.1.2.1.4.22.1.2"
 #
 # Get the data
 #
-snmpwalk -v 1 $host $cname $what | 2>&1 tr A-Z a-z > $temp
+snmpwalk -v2c $host -c $cname -t 10 -On $oid | 2>&1 tr A-Z a-z >
$temp
 #
 # Try to make up for the fact that snmpwalk doesn't write errors to stderr
 #
-grep -v $what $temp > $errs
+grep -v $oid $temp > $errs
 if test -s $errs; then
        cat $errs 1>&2
        rm -f $temp $errs
        exit 1
 fi
 #
-# Convert the results
+# Convert the results to "<MAC Address>tab<IP Address>" format
 #
 sed -e 's/[    ][      ]*/ /g' \
     -e 's/ = hex: /=/' \
     -e 's/ $//' \
     -e 's/ /:/g' \
-    -e 's/^.*\.\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\)=\(.*\)/\2    \1/' \
-    -e 's/:0/:/g' \
-    -e 's/^0//' $temp
+    -e
 's/^.*\.\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\):=:string::\(.*\)/\2\t\1/g' $temp
 #
 rm -f $temp $errs
+




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to