Solaris System Management Agent Developer's Guide

Deploying a Module as a Subagent

You can embed a MIB module that was written for the SMA into an external application. This application can be run either as an SNMP master agent or an AgentX subagent. Generally, you should run the SMA as the master agent, and set up your application as a subagent. The subagent attaches to the master agent, and registers its MIB with the master agent. By running the SMA as the master agent, you can easily add and remove subagents while the master agent continues to run. In this way, the agent can continue to communicate with network management applications.

SMA provides Net-SNMP API functions that enable you to embed an SNMP agent or AgentX subagent into an external application. In your application code, you must initialize your module, the SNMP library, and the SNMP agent library. This initialization is done slightly differently depending on whether the application is to run as a master agent or an AgentX subagent.

The functions that you use in the agent application include:

You must also link against the Net-SNMP libraries in your subagent application. The command


net-snmp-config --agent-libs

displays a list of libraries you need.

The demo_module_8 code example shows you how to create a subagent that calls a module that returns load averages.

demo_module_8 Code Example for Implementing a Subagent

The demo_module_8 code example demonstrates how to deploy a module in a subagent. The demo is by default located in the directory /usr/demo/sma_snmp/demo_module_8. The README_demo_module_8 file within that directory includes procedures for building and running the sample module and subagent program.

Subagent Security Guidelines

You must be aware of the following security considerations in writing subagents that use the AgentX protocol: