How to Write Embedded Event Manager Policies Using Tcl
SUMMARY STEPS
1. On your workstation (UNIX, Linux, PC, or Mac) create a library directory and copy the Tcl package files
into the directory.
2. tclsh
3. pkg_mkindex directory_name *.tcl
4. Copy the Tcl library files from
Creating an EEM User Tcl Package Index
device.
5. Copy a user-defined EEM policy file written in Tcl to the directory used for storing user-defined EEM
policies on the target device. The directory can be the same directory used in
Package
6. enable
7. configure terminal
8. event manager directory user library path
9. event manager directory user policy path
10. event manager policy policy-name [type {system | user} [trap]
11. event manager run policy-name
DETAILED STEPS
Step 1
On your workstation (UNIX, Linux, PC, or Mac) create a library directory and copy the Tcl package files into the
directory.
Step 2
tclsh
Use this command to enter the Tcl shell.
Example:
workstation% tclsh
Step 3
pkg_mkindex directory_name *.tcl
Use the pkg_mkindex command to create the pkgIndex file. The pkgIndex file contains a directory of all the packages
contained in the Tcl library files. We recommend that you run pkg_mkindex inside a directory because there can only
be a single pkgIndex file in any directory and you may have other Tcl files to be grouped together. Running pkg_mkindex
in a directory determines which Tcl package file or files are indexed using a specific pkgIndex.
Example:
workstation% pkg_mkindex eem_library *.tcl
The following example pkgIndex is created when some Tcl package files are in a library file directory and the
pkg_mkindex command is run.
pkgIndex
Example:
# Tcl package index file, version 1.1
Consolidated Platform Configuration Guide, Cisco IOS Release 15.2(4)E (Catalyst 2960-X Switches)
1800
Creating an EEM User Tcl Package Index
Index.
to the directory used for storing user library files on the target
and the pkgIndex file from
Creating an EEM User Tcl