Initially, the SNMP agent was implemented as a monolithic single-task entity that managed the MIB tree for its host. This agent handled all requests from SNMP manager. The WindNet SNMP agent is still capable of emulating this behavior, but, as of release 2.0, the WindNet SNMP also contains functionality in support of a distributed SNMP agent. That is, an SNMP agent that consists of a single master SNMP agent working together with one or more light-weight subagents.
At system startup, the SNMP master agent behaves exactly like any standard SNMP agent. However, it is the setup and management of the MIB tree that can be problematic. At compile time, it is often impossible to know exactly which devices will be attached to the target. Therefore, it is impossible to know at compile time exactly which MIB variables you must include in the agent's MIB tree.
Fortunately, VxWorks includes command-line utilities that you can use to add and remove MIB variables (and their associated methods) dynamically at run time. These command-line utilities are convenient enough during the development stage and can be collected into scripts when it comes time to deploy the system.
However, this mechanism of command-line utilities can be cumbersome to set up and manage as the system grows in complexity. Clearly, there is need for a more formal and more structured mechanism for managing the contents of a MIB tree. This mechanism is the SNMP subagent. For each device that you initialize and add to your target system, you also create an SNMP subagent.
This subagent, a light-weight version of the SNMP master agent, contains its own MIB tree and method routines. After initializing the SNMP subagent, you can register it with the SNMP master agent. This updates the SNMP master agent's MIB tree to know about the MIB variables stored in the subagent. It also adds special subagent-access functions to the method table in the SNMP master agent. These functions know how to queue SNMP requests on the subagent that manages the specified variable.
One advantage of this system of SNMP subagents is that it lets you set up per-device MIB variables at compile time. These per-device MIB variables can be added and removed as a group dynamically at run time without resort to user intervention or special scripts.
In addition, although the shipped implementation of the SNMP master agent and subagent communicate using shared memory (message queues), it is relatively easy to convert the code to use sockets instead. Because each SNMP subagent executes on its own task, using sockets makes it possible for the SNMP master agent and its subagent (or subagents) to run on different VxWorks machines.
Thus, if you are designing a system of cooperating VxWorks machines, it is possible to make them all SNMP manageable without having to run a full-sized SNMP agent on each. Instead, one machine can host an SNMP master agent while all the others run the light-weight SNMP subagents.