Template:FAQ:Agent 04

From Net-SNMP Wiki
Jump to: navigation, search

While simply adding a file to the MIB directory (and possibly tweaking the list of MIBs to load) is sufficient for the tools, unfortunately extending the functionality of the agent to include this is not so simple. In fact, the agent makes little or no use of these files, and will work quite happily without them. All the information about the syntax and scope of the variables supported is hardwired into the implementation of the agent.

There are a number of alternative ways to add functionality for a new MIB to the agent.

Firstly, it is possible that the agent distribution already includes the desired functionality, but this has simply not been configured in to the running version. This is done using the configure option

               --with-mib-modules="list"

(where "list" is a space-separated list of modules to include) then recompiling the agent. Note that some functionality concerned with monitoring and managing unix hosts is included in the UCD extension modules, which are located within the 'private' branch of the MIB tree. This is covered in a later question in this FAQ.

Secondly, it is possible for the agent to run commands or shell scripts in response to queries. These can obtain and report the necessary information, or perform actions as required. Detailed information and examples are provided in the snmpd(8) and snmpd.conf(5) manual pages, and the EXAMPLE.conf file. This is known as "pass-through" support.

Thirdly, it may be possible to link another agent (which already supports the desired MIB), as a "subagent" of the Net-SNMP master (or vice versa). The possibilities here are SMUX, AgentX or proxied SNMP (see the next question but one).

Finally, the agent itself can be extended to support additional MIB groups, by writing the necessary C code, and including this within the main agent - either statically compiled in, or dynamically loaded. This is covered further in the next section.

Note that there is no visible difference between pass-through MIB support, subagents, and modules implemented within the main agent itself. Tools querying the agent will see a single MIB structure.