1. Introduction to the System Management Agent
demo_module_4 Code Example for Alarms
Reading Data From the demo_module_4.conf Configuration File
Using SNMP_CALLBACK_POST_READ_CONFIG in demo_module_4
Generating Traps in demo_module_4
8. Long-Running Data Collection
10. Migration of Solstice Enterprise Agents to the System Management Agent
Typically, checking for trap conditions is done in the following sequence:
Get current data for a particular node.
Compare the data with a threshold to check if the trap condition is met.
Send a trap to the manager if the condition is met.
Steps 2 and 3 are implemented in SMA by calling an algorithm after data for a node is acquired. The algorithm determines if an alarm condition is met. The algorithm in most cases involves comparing the current data with the threshold. If the algorithm indicates that an alarm condition is met, the appropriate trap functions are called to issue a trap. In demo_module_4, steps 2 and 3 are performed in the following function:
void refreshLoadAvg(unsigned int clientreg, void *clientarg) { // Refresh Load data // Check if Load data crossed thresholds, send trap if necessary. check_loadavg1_state(); check_loadavg5_state(); check_loadavg15_state(); }
The check_loadavg_state functions compare the current load data with thresholds. The functions also send the traps if necessary.
The module must use a trap function such as send_v2trap() to send a trap to the manager. For more information on SNMP trap APIs, see /usr/sfw/doc/sma_snmp/html/group__agent__trap.html. The SNMP trap notifications are defined in SNMP-NOTIFICATION-MIB.txt. For demo_module_4, the trap notifications are defined in SDK-DEMO4-MIB.txt.