On Wed, 2005-06-08 at 00:20, Fong Tsui wrote: > When doing snmpwalk on a single column in a table which has 50 > columns, I found it queries data for all 50 columns and displays the > one needed. Itʼs wasting a lot by getting data not needed.
> I am using oid-api (v5.0.9 on linux) Probably the best way to think of the way a MIB module works is as two separate tasks. First the code needs to determine the appropriate row of the table that's needed for a particular request. Then it needs to select the appropriate column from that row. The traditional approach has been to populate the full contents of each row as part of selecting it (step 1) - which therefore ensures that the required column value is available for step 2. > Is there any way that I can make it skip unnecessary columns? It would be quite reasonable to postpone retrieving the individual column values until later, and only actually ask for the particular column that was requested. Just as long as the first stage provides some way to identify the row that's of interest. That would avoid having to bother with the 49 irrelevant values for each row. > Where is the code to decide when to stop walk? In the 'snmpwalk' command. The agent just sees a series of "GETNEXT" requests. Then it receives a request specifying the last row of the table, it will return the next valid object - typically the following column value from the first row of the table. It's up to the snmpwalk client to recognise that this response isn't relevant, discard it and stop. > Even walking an empty table; it goes through all columns > in that table. Yes - that's correct. The main agent driving code asks the MIB module for the next instance of the first column, and is told that there isn't one. It then asks for the next instance of the second column, and is told that there isn't one. And so on. You might be able to short-circuit this by tweaking the var_XXX() code, so that it updates the 'name' parameter to refer to the *last* column in the table. But I'm not 100% sure that will necessarily work. Suck it and See Dave ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
