event-handler activate

Activates an event handler and accesses event-handler activation mode, from which you can enter advanced configuration commands. You can also append the advanced commands to event-handler activate.

Syntax

event-handler activate event-handler-name
event-handler activate event-handler-name [ action-timeout minutes ] [ delay seconds ] [ iterations num-iterations ] [ interval seconds ] [ trigger-mode mode ] [ trigger-function { OR | AND [ time-window seconds ] } ]
no event-handler activate event-handler-name

Command Default

No event handler is activated on the device.

Parameters

event-handler-name
Specifies the name of the event-handler profile.
action-timeout minutes
Specifies the number of minutes to wait for an action-script to complete execution. If you specify "0", no timeout is set. Valid timeout values are any positive integer.
delay seconds
Specifies a number of seconds from when a trigger is received until the execution of the specified action begins. Valid values are 0 or a positive integer.
iterations num-iterations
Specifies the number of times an event-handler action is run, when triggered. Valid values are any positive integer. The default value is 1.
interval seconds
Specifies the number of seconds between iterations of an event-handler action, if triggered. Valid values are 0 or a positive integer. The default is 0.
trigger-mode mode
Specifies if an event-handler action can be triggered only once or more than once. The default is each time the trigger condition occurs, the event-handler action is launched.
each-instance
The event-handler action is launched on each trigger instance received.
on-first-instance
As long as the device is running, the event-handler action is launched only once. Following a device restart, the event-handler action can be triggered again.
only-once
For the duration of a device's configuration, the event-handler action is launched only once.
trigger-function
For an implementation of an event-handler profile, if multiple triggers are defined for an event-handler action, specifies if the action runs only if all of the triggers occur; or if one is sufficient.
OR
The event-handler action runs if any of the triggers occur.
AND
The event-handler action runs only if all of the triggers occur.
time-window seconds
In seconds, specify the time window within which all of the triggers must occur in order that the event-handler action runs. Once all triggers have been received and on each subsequent trigger received, the action will be launched when the time difference between the latest trigger and the oldest trigger is less than or equal to the configured time-window.

Modes

Global configuration mode

Event-handler activation mode for an existing event handler. (There is no need to enter the exit command.)

Usage Guidelines

You can activate up to 10 different event-handler profiles on a device.

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.
Following an initial triggering of an event-handler action, any subsequent trigger launches the action an additional time if the following conditions are true:
  • The trigger-mode parameter is set to the default each-instance.
  • The subsequent trigger occurs within the specified time-window.
For additional usage guidelines regarding the advanced configuration commands, see the following topics:
  • action-timeout
  • delay
  • iterations
  • interval
  • trigger-mode
  • trigger-function

To inactivate an event-handler instance on a device, use the no form of this command. If an event-handler Python script is running, it is executed to completion before inactivation of the event handler.

Examples

This example activates eventHandler1 on the device.

device# configure terminal
device(config)# event-handler activate eventHandler1
device(config-activate-eventHandler1)#