Network OS Administration Guide

Supporting Network OS 6.0.1a

Part Number: 53-1003768-04

Configuring an event-handler profile

Use this procedure to create an event-handler profile, define one or more triggers for it, and specify a Python script that runs upon one or more trigger events.

Before you begin, make sure you have performed Implementing Python scripts.

  1. Enter configure terminal to access global configuration mode.
    device# configure terminal
  2. Enter the event-handler command.
    device(config)# event-handler eventHandler1
  3. For each trigger that you need for a profile, enter the trigger command.
    device(config-event-handler-eventHandler1)# trigger 1 raslog LOG-1001
    The trigger event is RASlog message #LOG-1001.
  4. Enter the action python-script command to specify a Python script that runs when the event-handler is triggered.
    device(config-event-handler-eventHandler1)# action python-script example.py
Note Icon
CAUTION
Make sure that you test Python scripts according to standard quality assurance practices before deploying them.

The following example includes all of the above steps.

device# configure terminal
device(config)# event-handler eventHandler1
device(config-event-handler-eventHandler1)# trigger 1 raslog LOG-1001
device(config-event-handler-eventHandler1)# action python-script example.py