On 16 January 2013 08:31, Zheng, Wenjie (Barclay)
<barclay.zh...@alcatel-lucent.com> wrote:
> I spend some time to study the iterator helper to retrieve external data 
> outside from SNMP agent.
> I found that iterator uses a 'get first' and 'get next' way for get and 
> getbulk requests.

The iterator uses 'get_first' and 'get_next' hooks to work through the
table data,
in order to find the appropriate row for a particular (individual) request.
This holds true for *all* SNMP requests - Get, GetNext, GetBulk and Set.

> And for GET request, agent will also use this hook routine to find the index.
> What's the reason behind this?

In order to find the row that it needs to use in order to process the request.
Remember, the external data may not be ordered in the same way as required
for SNMP requests - the agent needs to iterate through the rows in order to
find the correct one.
   The clue is in the name!   :-)


> Is there a document I can refer to know how the get first get next works?

Have you read the documentation about the table_iterator on the project
website?


> For external data, is there a better way for GETBULK request?
> Suppose external data can be get via blocks(one block has multiple OID data).

If you can grab the external data in a block, then the usual approach
would be to use an internal cache to hold a complete copy of the table,
and use that for processing incoming requests.   The timeout of the cache
can be set to force a reload whenever the data will be regarded as "too old".

The mib2c.iterator.conf template can support that approach (using "-Scache=1")
but will still walk through the rows for each incoming request.
It would be more efficient to use the mib2c.table_data.conf template
(again using "-Scache=1"), which can go direct to the required row.
Or possible the MfD template - but I don't have a great deal of experience
with that one.

Dave

------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to