1. Introduction to the System Management Agent
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
10. Migration of Solstice Enterprise Agents to the System Management Agent
In the SNMP manager polling method, an SNMP manager polls a status variable to find out whether a data collection is complete. When the data collection is complete, the age of the data is determined. If the date of the data is not acceptable, the manager can set the status variable to start a new collection. The polling method is recommended if you have one SNMP manager that is to control the polling of one or more agents. The demo_module_10 example demonstrates the SNMP manager polling approach.
The demo_module_10 code is located by default in /usr/demo/sma_snmp/demo_module_10. The README_demo_module_10 file within that directory contains instructions that tell how to perform the following tasks:
Compile source files to generate a shared library object that implements a module
Set up the agent to dynamically load the module
Test the module with snmp commands to show that the module is functioning as expected
The demo_module_10 example implements the objects defined in the SDK-DEMO10-MIB.txt. The module is designed to handle long-running data collections so that their values can be polled by an SNMP manager. The module also shows 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.
The demo_module_10 module uses the following features:
Sets the delegated member of the requests structure to 1 to indicate to the agent that this request should be delayed. The agent queues this request to be handled later and then is available to handle other requests. The agent is not blocked by this request.
Registers an SNMP alarm to update the results at a later time.
Uses status variable to communicate the status of a data collection to the polling SNMP manager.
Uses refreshTime variable to return the date and time that the data collection completed.
A race condition can occur with two or more management applications. When multiple applications issue GET or SET protocol operations that span more than a single PDU, competition for the results occurs. In the case of a long-running data collection, a race condition can occur when the module completes data collection. The module updates the status variable to indicate that the data is ready to send. However, the agent issues a second GET operation on the same variable before the first request receives the requested data. If the module starts a new data collection in response to the second request, no data is available to return to the first request.
In the following figure, Mgr2's request is received by the module after Mgr1's request but before Mgr1 gets the data. This situation could happen if the module starts a new data collection while requests are pending.
Figure 8-1 Race Condition When Polling for Data
To avoid this scenario, a module can define a flag to maintain the state of outstanding requests. When an SNMP request is received, the module checks the flag. The module starts a new collection only if no SNMP requests are outstanding. The module returns an SNMP error if requests are outstanding.