AgentX: register an OID subtree for a callback function, no MIB, no generated code

Christian Thießen <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hello!
The program I am currently working on is a standalone daemon which
regularly queries values from hardware devices and, among other things,
provides them via SNMP (as a subagent). It gets its configuration (OID
tree structure, but also hardware query commands, update rates and so
on) from an XML file, so in order to have all information in one place,
I decided not to use MIB files. (It's absolutely ok to me to only have
numerical OIDs, no naming needed). I would also like to be able to
unregister and re-register subtrees in case my configuration file
changes, so using the mib2c code generator is not an option.

The only thing I need from the SNMP library is to register the subtree I
am managing and get callbacks whenever a value is queried. Values are
ints or strings, there are no tables or other complicated stuff. I guess
it should look like:

snmp_init();
snmp_register_subtree(root_oid,callback_func,user_ptr);

void callback_func(oid *oid,type *type,void *value,void *user_ptr) {
    //lookup OID in my own data structure
    //if found:
       //set type correctly
       //set value to the requested data
    //else
       //return some kind of "not found" indicator, maybe NULL
}

Unfortunately, searching through the net-snmp tutorials, documentation,
mailing lists and the rest of the web didn't quite get me an answer.
Maybe you can give me a pointer?
Sincerely,

Christian THIESSEN

------------------------------------------------------------------------------
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
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.