Solaris System Management Agent Developer's Guide

Asynchronous Trap Notification

Typically, checking for trap conditions is done in the following sequence:

  1. Get current data for a particular node.

  2. Compare the data with a threshold to check if the trap condition is met.

  3. 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.