Reload EEM Tcl policy with an EEM applet

Developing Embedded Event Manager (EEM) Tcl policies is "a bit" tedious task. Usually you would edit the source file on an external workstation, then you have to download it into the router (IOS will not read EEM policy from an external source), re-register it with EEM (when you register a policy it gets copied from the source file into system:lib/tcl/eem_registered_scripts directory) and test it. To automate this process, I've written a small EEM applet that does the tedious steps automatically. Configure the following EEM applet (replacing ep.tcl with your policy name and nvram: with your router storage device):
event manager applet LoadMyPolicy
event none
action 1.0 cli command "configure terminal"
action 1.1 cli command "no event manager policy ep.tcl"
action 1.2 cli command "file prompt quiet"
action 1.3 cli command "exit"
action 2.0 cli command "copy tftp://10.0.0.10/tcl/ep.tcl nvram:ep.tcl"
action 3.0 cli command "configure terminal"
action 3.1 cli command "event manager policy ep.tcl"
action 3.2 cli command "exit"
Define an alias to start the load process with a simple command:
alias exec load event manager run LoadMyPolicy
Now you can use the newly-created exec-level load command to load and re-register your EEM policy.
Add comment
Sidebar