On 1 March 2011 13:04, Reto Jaeger <[email protected]> wrote:
> I have implemented an snmp subagent using the agent-x protocol.
> When I do a snmpwalk operation I see that all leaf handlers are called
> twice. The leaf handlers are called once (as expected) when I performing
> a snmpget operation.

When you talk about "leaf handlers", do you mean the handlers for scalar
objects,  or the handlers for column objects within a table (or both)?

Both scalar and column objects are leaf objects within the SMI structure,
but the implementation code is typically very different.



> My question is: Why the leaf handlers called twice on a snmpwalk operation?

How have you implemented these handlers?
What sort of registration call(s) are you using?

Running an 'snmpwalk' on a scalar object will typically result in two GETNEXT
requests (one to retrieve the actual value of the scalar instance itself,
and one to retrieve the "next" value, which is then discarded).

But the scalar (and instance) helpers ought to distinguish between
valid and invalid instances,  and filter out the invalid requests automatically.
The object-specific handler should only be called once.
   I've just confirmed this with the two scalar objects in the agent/nsCache.c
module - issuing
    snmpwalk .... nsCacheDefaultTimeout
           only calls the nsCacheDefaultTimeout handler once (for processing
"GetNext nsCacheDefaultTimeout").  The second GETNEXT request
("GetNext nsCacheDefaultTimeout.0") is caught by the scalar helper.


Of course, if you're not using either of these helpers, and registering
your module using a basic handler, then this *will* be called twice,
due to the way that the SNMP GetNext protocol operation works.

A lot will depend on exactly what your code looks like.

Dave

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to