Robert, Thanks for the help. Was finally able to get this the other day and your explanation below was exactly the reason.
> -----Original Message----- > From: Robert Story [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 24, 2004 9:43 PM > To: Hoover Mark A AISC CONT > Cc: '[EMAIL PROTECTED]' > Subject: Re: pass-through and getnext > > > On Mon, 23 Aug 2004 09:48:50 -0400 Hoover wrote: > HMAAC> I'm attempting to override the non-value for > hrProcessorLoad in order to > HMAAC> allow SolarWinds to poll our Linux servers since > net-snmp doesn't > HMAAC> provide a value for this internally. The script below > works fine if the > HMAAC> specific OID is polled, but doesn't work properly when > doing a snmpwalk. > HMAAC> [...] > HMAAC> I'm hoping somebody with more insight than I can look > at the following > HMAAC> and tell me why this isn't working. I tried replacing > the -n section > HMAAC> with a section that looks similar to the -g section > (with a different > HMAAC> OID) with no luck. > HMAAC> > HMAAC> Any help would be appreciated. > HMAAC> > HMAAC> #!/bin/bash > HMAAC> > HMAAC> if [ "$1" = "-g" ]; then > HMAAC> echo ".1.3.6.1.2.1.25.3.3.1.1.769" > HMAAC> echo "objectid" > HMAAC> echo "0.0" > HMAAC> elif [ "$1" = "-n" ]; then > HMAAC> echo ".1.3.6.1.2.1.25.3.3.1.2.769" > HMAAC> echo "integer" > HMAAC> echo `/usr/bin/mpstat | /bin/grep all | > /bin/awk '{ printf > HMAAC> "%.0i",100-$7+1}'` > HMAAC> else > HMAAC> echo ".1.3.6.1.2.1.25.3.3.1.2.769" > HMAAC> echo "integer" > HMAAC> echo `/usr/bin/mpstat | /bin/grep all | > /bin/awk '{ printf > HMAAC> "%.0i",100-$7+1}'` > HMAAC> fi > > The problem is that you aren't paying attention to the second > argument ($2), > which gives you the OID you are supposed to be working with. > Simplifying for > brevity, if you register a script at X, a walk should go > something like this: > > -> script -n X > <- X.1.0 > <- integer > <- 42 > > -> script -n X.1.0 > <- X.2.0 > <- string > <- thanks for all the fist > > ->script -n X.2.0 > <- [nothing, just exit (ie End of Mib) > > Note that the OID returned from each call will be the second > parameter for the > next time around. What you have will result in an infinte loop: > > -> script -n X > <- X.2.769 > <- ... > > -> script -N X.2.769 > <- X.2.769 > <- ... > > etc, etc. > > > So you either need to make your script more complex to handled the two > variables that you have, or simplify into two scrips that > each only handle one > variable (but you still need to look at $2 to know whether or > not to return > data). > > > -- > Robert Story; NET-SNMP Junkie <http://www.net-snmp.org/> > <irc://irc.freenode.net/#net-snmp> > Archive: > <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-users> > > You are lost in a twisty maze of little standards, all different. >
smime.p7s
Description: S/MIME cryptographic signature