> From: Christian Thießen [mailto:[email protected]]
> Sent: Sunday, March 14, 2010 1:16 AM
> 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.
Nonetheless, it's a good idea to write a MIB, both for your own
reference and for anyone else who may use this MIB or maintain the code, or
just so that SNMP tools can name objects. MIBs have many uses other than mib2c.
> 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
> }
Look here:
http://www.net-snmp.org/docs/man/netsnmp_handler.html
You'll only be interested in a subset of what's on that page, but that
should have what you're looking for.
HTH,
Mike
------------------------------------------------------------------------------
Download Intel® 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