Specifies an ID number for the trigger. Valid values are 1 through 100, and must be unique per event-handler profile.
raslograslog-id
Specifies a RASlog message ID as the trigger. String can be 1 through 32 characters long.
patternposix-ext-regex
Specifies a POSIX extended regular expression to search within the specified RASlog message ID.
patterntrigger-pattern
Specifies a sequence of strings with included regular expressions to search within the specified RASlog message ID. Contains alphabets, digits and all characters supported in regex. String can be 1 through 128 characters long.
Modes
Event-handler configuration mode
Usage Guidelines
You can create from 1 through 100 triggers per profile.
You can also define one trigger as part of the
event-handler command.
To delete one or all triggers, use the
no form of this command, as follows:
To delete all triggers, enter
no trigger.
To delete a specific trigger, enter
no triggertrigger-id
Note
You cannot delete the last remaining trigger from an activated event-handler profile.
You can modify an existing trigger without deleting it and then re-creating it.
If the event-handler for which you are modifying triggers is active on the device, the changes take effect with no need to de-activate and re-activate the event-handler.
A Python event-handler script runs only if all of the following occur:
Using the
copy command, copy the Python file to the
flash:// location on the device.
Using the
event-handler command, create an event-handler profile.
In configuration mode for that profile:
Using the
trigger command, create one or more triggers.
Using the
action command, specify the Python script that will be triggered.
Using the
event-handler activate command, activate an instance of the event handler.
The trigger event occurs.
Examples
The following example defines triggers in two event handlers.
The following example defines a trigger that uses POSIX extended REGEX to search for a match within a specified RASlog message ID.
device# configure terminal
device(config-event-handler-eventHandler1)# event-handler eventHandler2
device(config-event-handler-eventHandler2)# trigger 1 raslog NSM-1003 pattern Interface Ethernet 1/[1-9] is link down
RASlog message NSM-1003 includes "interfaceinterface-name is link down", indicating that an interface is offline because the link is down. The REGEX searches within such a message for an interface from 1/1 through 1/9.