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. ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Net-snmp-users mailing list [EMAIL PROTECTED] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users