Difference between revisions of "FAQ:Coding 10"
m (Latest FAQ revision - preparing for 5.5 release) |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | = | + | = Are there any examples, or documentation for developing MIB modules? = |
| − | {{FAQ: | + | <!-- NB: |
| + | There is a mismatch between the template numbering | ||
| + | for this entry, and the FAQ entries that refer to it. | ||
| + | This follows a review of the entries in the | ||
| + | Coding section. | ||
| + | --> | ||
| + | {{FAQ:Coding_11}} | ||
[[FAQ:Coding]] | [[FAQ:Coding]] | ||
{{FAQ:Coding}} | {{FAQ:Coding}} | ||
Latest revision as of 19:46, 20 July 2009
Are there any examples, or documentation for developing MIB modules?
Many of the MIB modules shipped with the Net-SNMP agent still
use the v4 "traditional" MIB module API, but an increasing number
use one of the newer v5 helper-based handlers. All of these can
be found under agent/mibgroup
The tdata helper is used in the new DisMan Event,
Expression and Schedule MIB modules
(see disman/{event,expr,schedule}/*).
The similar dataset helper is used in the older DisMan Event
MIB implementation (see disman/mteEvent*)
and the Notification Log MIB (see notification-log-mib/*),
used by snmptrapd to log incoming traps.
The basic iterator handler is used in
the TCP and UDP table implementations (mibII/tcpTable &
mibII/udpTable), VACM context handling (mibII/vacm_context) and
various tables relating to agent internals (agent/*).
These show
a number of different approaches to using the iterator helper, so
it's worth comparing them.
The two examples/netSnmpHostsTable* modules provide a
contrast between the iterator and iterator_access helpers.
There are several examples based on the
MfD framework (see {if,ip,tcp,udp}-mib/). Much of this
code is not intended to be viewed directly, but individual files
are clearly commented to distinguish between internal implementation
and public code.
The Net-SNMP agent does not currently include any MIB modules
using the array-user container-based helper. The best examples
of this are to be found in the net-policy project.
See http://net-policy.sourceforge.net/
FAQ:Coding
- How do I write C code to integrate with the agent?
- How does the agent fetch the value of a MIB variable from the system?
- Mib2c complains about a missing "mib reference" - what does this mean?
- Mib2c complains about not having a "valid OID" - what does this mean?
- Why doesn't mib2c like the MIB file I'm giving it?
- Mib2c ignores my MIB and generates a pair of 'mib-2' code files. Why?
- What's the difference between the various mib2c configuration files?
- Which mib2c configuration file should I use?
- How can I have mib2c generate code for both scalars and tables?
- Are there any examples, or documentation for generating MIB modules?
- Where should I put the files produced by 'mib2c'?
- Why doesn't my new MIB module report anything?
- Why does the iterator call my get_{first,next} routines so often?
- How can I get the agent to generate a trap (or inform)?
- How can I get an AgentX sub-agent to generate a trap (or inform)?
- How can I get the agent to send an SNMPv1 (or SNMPv2c) trap?
- How can I get the agent to include varbinds with an SNMPv1 trap?
- How can I get the agent to send an SNMPv1 enterprise-specific trap?
- How can I get the agent to send an SNMPv3 trap (or inform)?
- Why does calling 'send_v2trap' generate an SNMPv1 trap (or vice versa)?
- How can I register a MIB module in a different (SNMPv3) context?