[mrtg] script problem
Justin Shore
listuser at vinnie.ksu.ksu.edu
Sat Feb 19 03:04:36 MET 2000
Greetings all. I wrote up this little script to find the current
port that a DSL user was connected to on our Cisco 3660. The script
works great except for when the user signs off. It emails me every X
number of minutes with an error like this one:
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
This name doesn't exist:
ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex.63.237.114.173
Its not a major thing but it is a pain in the ass. Could someone
offer a way to make this script return a 0 if its encounters the
error? Here's the script.
TIA
Justin
[mrtg at ipgate bin]$ cat get-dynamic-port
#!/bin/bash
HOST="$1"
COMMUNITY="$2"
TARGET="$3"
SNMPCMD="/usr/local/bin/snmpget"
GET_PORT="ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex"
GET_IN="interfaces.ifTable.ifEntry.ifInOctets"
GET_OUT="interfaces.ifTable.ifEntry.ifOutOctets"
GET_UPTIME="system.sysUpTime.0"
PORT=`$SNMPCMD $HOST $COMMUNITY $GET_PORT.$TARGET |awk '{print $3}'`;
#echo "$PORT";
IN=`$SNMPCMD $HOST $COMMUNITY $GET_IN.$PORT |awk '{print $3}'`;
echo "$IN";
OUT=`$SNMPCMD $HOST $COMMUNITY $GET_OUT.$PORT |awk '{print $3}'`;
echo "$OUT";
UPTIME=`$SNMPCMD $HOST $COMMUNITY $GET_UPTIME |awk '{print $5,$6, $7}'`;
echo "$UPTIME";
echo "$HOST";
--
Justin Shore
K-State Linux Distro Mirror, Sysadmin
macdaddy at vinnie.ksu.ksu.edu
<http://vinnie.ksu.ksu.edu/mirror/rpm2html>
<ftp://vinnie.ksu.ksu.edu/pub/mirror/linux>
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:mrtg-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/mrtg
More information about the mrtg
mailing list