Template:FAQ:Agent 10
That's not easy to answer in general.
If there's an existing agent that already implements the desired new MIB, then it makes sense to re-use that, via whatever extension protocol it might support. Ideally, this would be an AgentX sub-agent, since the AgentX protocol is deliberately designed for this purpose, and provides a fuller and more reliable mechanism than either SMUX or proxied SNMP. But if the target subagent only supports SMUX or basic SNMP, then that would dictate the extension protocol to use.
Implementing the module directly within the main agent (or via dlmod) is probably the most efficient and reliable (since there's minimal overheads between the code implementing the MIB module, and the agent framework). But it does assume that there's a suitable mechanism for retrieving the necessary information.
If the new MIB is monitoring or managing some other subsystem, external
to the agent, then it may be necessary to embed a subagent within the
subsystem itself - particularly if there's no suitable public API to
retrieve the necessary information. In this case, AgentX is probably
the most appropriate way forward.
Unless you prefer to implement the missing public management API,
and develop a module within the main agent instead.
In terms of writing C code for the Net-SNMP agent, the way that the
(sub-)agent receives the request is more or less irrelevant. The
MIB module API was deliberately designed to be independent of any
extension mechanism being used - so the exact same module code could
be included as part of a pure-SNMP master agent, or an AgentX subagent,
either compiled in or dynamically loaded. No modifications should be
needed to the MIB module code itself - just to how it's compiled into
the appropriate application.