On 25 March 2010 00:55,  <khan_...@emc.com> wrote:

> Here is my init routine:
>
>     55 void init_software(void)
>     56 {
>     85     netsnmp_register_table_iterator(handler, iter);

This is registering a handler chain (based around the
iterator handler) for the specified OID - the root of the table.


>     88     rc = netsnmp_register_cache_handler(...);

This is registering a separate handler chain
(based around the cache helper) for the specified OID.
If you give it the root of the table, then the agent will
think
    "But something is already looking after that OID.
     I can't have two registrations fighting over the same request"
and reject the registration.

If you give it a different (higher) OID, then the agent
will be happy about having two separate registrations,
because they are looking after different OID trees.

The cache helper will be called for anything *before*
the table (and anything after it).   So a global walk will
trigger the cache registration before it gets to the table.

But a walk that starts with the table OID, won't call the cache
registration handler chain, and will go straight to the
iterator-based one.   So the data won't be loaded.


What you need to do is insert the cache helper into the
iterator-based handler chain, *BEFORE* registering this chain.

Have a look at the existing cache-based hrSWRunTable implementation
(in agent/mibgroup/host/hrSWRunTable.c) which does exactly this.


In fact, you'd probably be better off working with that code anyway,
rather than trying to re-write it yourself.   Particularly using the
iterator helper, which is notoriously inefficient with large tables
(such as hrSWRunTable!)

Dave

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to