[mrtg] Re: script problem

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Sat Feb 19 10:31:26 MET 2000


Justin Shore wrote:
> 
> 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

You need to filter out the error message.  You can do so by checking
the first character:

[alex at home]$ snmpget router public 4.21.1.2.10.2.2.2
Error in packet.
Reason: There is no such variable name in this MIB.
This name doesn't exist: ip.ipRoutingTable.ipRouteEntry.ipRouteIfIndex.10.2.2.2

[alex at home]$ snmpget router public 4.21.1.2.10.2.2.1
ip.ipRoutingTable.ipRouteEntry.ipRouteIfIndex.10.2.2.1 = 3

As you can see, valid route entries start with "ip" whereas invalid answers
return "This name...."

If your snmpget does it different, I'm sure you can find a similar approach.

> [mrtg at ipgate bin]$ cat get-dynamic-port

[...]

> PORT=`$SNMPCMD $HOST $COMMUNITY $GET_PORT.$TARGET |awk '{print $3}'`;

This line fails if the IP address doesn't exist.  You could change it
into
PORT=`$SNMPCMD $HOST $COMMUNITY $GET_PORT.$TARGET |awk '/^ip/{print $3}'`
to filter out the garbage.

Then check for an empty $PORT and echo 0:

if [ -z "$PORT" ]
then
	echo 0
else
	# rest of script
fi

regards,
Alex
-- 
   __________________________________________________________________
 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+

--
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