Cisco TCL/EEM HowTo
Some pointers for TCL/EEM setup.
Basic EEM config
(config)# event manager directory user policy "flash0:/" # show event manager directory user library (config)# event manager policy monitorCO.tcl # show event manager policy registered (config)# no event manager policy monitorCO.tcl # show event manager history events # event manager run monitorCO.tcl
To execute monitor in a loop
(config)# event manager environment monitorCO_INTERVAL 30 # show event manager environment
How to get the TCL code to Cisco flash
- Start tclsh;
- Enter
puts [open "flash0:/monitorCO.tcl" w+] {
Do NOT hit the ENTER key at the end of the line.
- Copy-paste the file contents. The contents should not include unmatched curly right brackets (every curly right bracket has to be preceded by a matching curly left bracket).
- After the file contents have been pasted, enter }, and press ENTER.
- End the tclsh session with tclquit.
Check that your file was correctly inserted to flash:
# more monitorCO.tcl
kron example
! kron occurrence minute in 1 recurring policy-list monitorCOrun ! kron policy-list monitorCOrun cli event manager run monitorCO.tcl !