2010/3/14 Christian Thießen <[email protected]>:
> in order to have all information in one place,
> I decided not to use MIB files.
I would second Mike's suggestion that you reconsider this decision.
A MIB file is extremely useful as part of formalising the structure
of what information your agent will return. You are essentially
defining a MIB anyway - by the simple fact of returning (OID,type,value)
triples from the agent.
The MIB file is simply an explicit representation of this (implicit) MIB.
I often refer to it as the "design document". It would be naive and
unprofessional to start developing a software application without some
form of design structure (however informal). Writing down the MIB file
is essentially the same thing for SNMP management development.
> Values are ints or strings, there are no tables or other complicated stuff.
If there are no tables, that means everything will be a scalar object.
In which case, you might as well use the 'scalar' or 'scalar_group' helper.
(Either directly or using one of the watcher-based versions)
Alternatively, if you want to use a single handler routine to implement
the whole of the MIB subtree, then the bare framework you've outlined
is basically correct.
You'd register the subtree using "netsnmp_register_handler()"
and the basic template of the callback routine would be
the same as any other handler in the Net-SNMP code.
Bear in mind that you'll need to handle
- GET requests (return the value for the specified OID)
- GETNEXT requests (return OID,type,value for the *next* object
following the specified OID)
- SET requests (updating the value for the specified OID,
using a multi-pass processing model).
Most of this is the same as other MIB modules.
The main thing that the MIB helpers typically deal with is
parsing the OID, and extracting index values (for tables)
or identifying invalid scalar object requests.
The MIB-specific handler can then concentrate on the value-related
processing, without having to worry about the low-level donkeywork.
But if you're happy to handle this as well, then a basic registration
with no special helpers should work OK.
Dave
------------------------------------------------------------------------------
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