JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Solaris System Management Agent Developer's Guide
search filter icon
search icon

Document Information


1.  Introduction to the System Management Agent

2.  Creating Modules

3.  Data Modeling

4.  Storing Module Data

5.  Implementing Alarms

6.  Deploying Modules

7.  Multiple Instance Modules

8.  Long-Running Data Collection

About Long-Running Data Collection

SNMP Alarm Method for Data Collection

demo_module_9 Code Example for SNMP Alarm Method

Managing the Timing of Data Collection

SNMP Manager Polling Method for Data Collection

demo_module_10 Code Example for SNMP Polling Method

Avoiding a Race Condition When Polling

9.  Entity MIB

10.  Migration of Solstice Enterprise Agents to the System Management Agent

A.  SMA Resources

B.  MIBs Implemented in SMA



SNMP Alarm Method for Data Collection

In the SNMP alarm method for long-running data collection, the module registers an SNMP alarm to call a function at a specified interval. The interval is specified in seconds. The function can be called one time, or called repeatedly until the alarm is unregistered. The module sets a flag that causes the agent to delegate the SNMP request. By delegating a request, the agent avoids blocking other requests while responding to a request. The agent caches the SNMP request information to be retrieved later when the request is handled. The demo_module_9 example demonstrates the SNMP-alarm-based approach.

demo_module_9 Code Example for SNMP Alarm Method

The demo_module_9 code is located by default in /usr/demo/sma_snmp/demo_module_9. The README_demo_module_9 file within that directory contains instructions that describe how to perform the following tasks:

The demo_module_9 example implements the objects defined in the SDK-DEMO9-MIB.txt. The module demonstrates how to implement objects that normally would block the agent as the agent waits for external events. The agent can continue responding to other requests while this implementation waits.

This example uses the following features:

Managing the Timing of Data Collection

An important aspect of the demo_module_9 example is the relationship between the SNMP timeout and the delay time interval of the module. The delay time interval is the interval in seconds after which the agent sends an alarm to the module. The delay_time variable in the module stores this value. By default, the delay time is set to 1 in the module. You can change this value by issuing an snmpset command on the delayedInstanceOid object and supplying an integer value. The set_demo_module_9 script does issue the snmpset command to change the delay time interval. The new time interval value is used by the module to register for an alarm with the agent.

The agent calls the module when a snmpget or snmpset is issued on the delayedInstanceOid object. Instead of returning the requesting data right away, the module sets a flag to tell the agent that the request processing might take a while. The agent is free to handle other requests. The module then registers an alarm with the agent. The module needs some way to get the agent to return to the module and return the requested data when the data collection has completed. In demo_module_9, a one-time alarm is set to go off in 1 second. If you want a longer data collection, you can set the delay_time value to a longer interval. You can also set the alarm to go off repeatedly at a specified interval.

The module registers the alarm with a callback function. At the specific alarm interval, the agent calls the callback function in the module. In demo_module_9, the callback function is return_delayed_response(), which actually handles the SNMP GET or SNMP SET request.

The client that requested the data with SNMP GET must wait for the response from the agent. The snmpget command and other Net-SNMP tools have a default timeout value of 5 seconds. The client is likely to time out before getting the requested response. For this reason, you should increase the timeout value for the snmpget and snmpset commands.

You should increase the timeout of the command the amount of time required to complete the data collection. If you are doing an snmpset, make the timeout value 3 or 4 times longer than the delay time interval. A longer timeout is needed because a SET operation is more time-consuming than a GET. The agent makes several calls to the module to process a single SET, and each call is delayed by the delay value.

The -t option is used to set the timeout value. See thesnmpcmd(1M) man page for more information about common command-line options for Net-SNMP tools.