For more sophisticated SNMP trap processing, you can define an ASL script in a trap definition that is invoked during the processing of the trap. To define an ASL script, you add the keyword ASL, followed by the ASL script name, to the trap definition. For example:

BEGIN_TRAP  .  0  0
 ClassName:   System
 ASL:         my-trap-rules.asl
 EventName:   ColdStart
 Type:        MOMENTARY

Notification attribute values are initially determined by the trap definitions. If an attribute value has not been defined by a trap definition, then the value for the attribute will come from the default section. The notification attribute values are exported from within the ASL script. The ASL script can override default attribute values. After the ASL script completes, the notification is created with those sets of values.

The ASL script relies on two special types of variables: input/output and input-only. Input/output variables correspond to attributes of the notification and the parameters in the configuration file. The input-only variables correspond to the variables used in the configuration file (for example, $SYS$, $V4$, and $N$).

A DISCARD_TRAP variable is included with the input/output variables. The variable controls whether a given trap message is discarded or processed. The default value for this variable is “NO,” which means the trap must be processed. To override the default and discard the trap, create a rule in the functional loop of the hook script in my_trap_rules.asl to process the trap, and within this rule set the DISCARD_TRAP to “YES.”

To run the ASL script, you must place it in the BASEDIR/smarts/local/rules/icoi-trapd folder. Further, ensure that you include the hook script in the trap definition in the trap_mgr.conf file for the hook script to be invoked for a particular OID.