1
votes

I have written multiple Net-SNMP MIB modules that need that share a global structure between them.

The options I have thought of:

  1. Find a way to have 2 or more MIB modules use common code. (not sure if this is possible)
  2. Combine the MIB modules into one MIB module set up structure during init__MODULE function. (Is this bad practice it would be about 10 handlers in the module)
  3. Linux shared memory (not really looking to do this)

Other info: The MIB modules are being compiled into the master agent.

1

1 Answers

0
votes

It depends, what those "different MIB modules" actually are:

  • objects from different MIB files - do not do this, as the common code will disobey some standards (one MIB file represents one particular agents ; agent do not suppose to know about other agents)
  • different objects from the same MIB (in this scalars and tables ) - yes, you can, but I would not recommend doing this. It is better to you use some specific API's functions for tables separately as they could be really helpful.
  • scalars from the same branch ( as in 1.3.6.1.2.1.5 icmp branch of MIB-2 MIB) - YES, that will good choice to generalize your code. Here You can use scalar_group handler.