04-26-2016 12:36 PM
I was wondering we have templates for our managed devices. We have 3 or 4 TCL scripts per device, when we add a new device we load the template and then manually add the TCL script to the correct folder.
My question is there any way to load a TCL from our template instead of manual moving files to the correct folder on the cisco device. I was testing with a simple script that will simple print to the log. This works correctly if I copy and paste from the command line but nested in the config file it will never create the file. Is there a limitation that "cisco interpreter"(basically copying a config file to startup and reloading) that will not allow tclsh to work correctly.
<Some configs>
interface blah
ip blah
<Some Configs>
tclsh
puts [open flash:/tcl/test.tcl w+] {
::cisco::eem::event_register_none
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
action_syslog msg "TESTING TCL LOADER"
}
tclquit
!
event manager policy test.tcl
<Some configs>
end
Solved! Go to Solution.
04-27-2016 10:53 AM
Do they have to be Tcl? Can you use applets instead? At least the basic connectivity policy can be an applet to bootstrap things enough to get the Tcl policies.
04-27-2016 06:26 AM
If the devices support EEM 4.0, you can have them load directly from the remote server:
event manager policy test.tcl remote URL
Else, you can add "do" lines to the startup config to put the file in place:
do event manager update user policy name test.tcl repository URL
This assumes those commands will not be interactive, though.
As a final solution, consider creating an applet policy that will fetch all of the required Tcl policies at boot time, and then remove itself.
04-27-2016 09:09 AM
Thanks Joe!
The issue is some of the scripts we use are for connectivity depending on link availability. So the issue we would run into is to reach the URL we would need the script and to reach the URL the script is needed (run into a chicken and the eggs problem)
04-27-2016 10:53 AM
Do they have to be Tcl? Can you use applets instead? At least the basic connectivity policy can be an applet to bootstrap things enough to get the Tcl policies.
04-27-2016 11:05 AM
I do like the idea of using an applet to get enough connectivity working correctly to ensure connectivity to the remote server. Some of the TCL are pretty complex so this may be a challenge but this sounds like the only real solution vs loading the script manually.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide