Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

Is it possible to call a tclsh script from EEM?

I thought it would be best to create another discussion for this topic, as this seems to be a separate request altogether.  

If I have a TcL Script on a scp server, can I call it from within EEM?

 

Something along the lines of this, although it's not working...

if { [catch {cli_open} result] } {
    exit 1
}

array set cli $result
 
cli_exec $cli(fd) "enable"
cli_exec $cli(fd) "tclsh scp://username:password@10.0.0.1/script.tcl"
 

catch {cli_close $cli(fd) $cli(tty_id)}

4 REPLIES
New Member

Found a dirty workaround. I'm

Found a dirty workaround. I'm still very interested in a better solution.  I think the issue is having "exec" used in the tcl file I'm calling.

alias exec TcL tclsh

 

if { [catch {cli_open} result] } {
    exit 1
}

array set cli $result
 
cli_exec $cli(fd) "enable"
cli_exec $cli(fd) "TcL scp://username:password@10.0.0.1/script.tcl"
 

catch {cli_close $cli(fd) $cli(tty_id)}

Cisco Employee

I'm confused.  Why would you

I'm confused.  Why would you do this rather than just adding the contents of the script.tcl to the EEM policy?  Yes, you'll need to make changes for exec and ios_config, but the end result will be much cleaner, perform better, and give you better results in terms of CLI interaction.

New Member

Hi Joseph,I have a lot of

Hi Joseph,

I have a lot of remote sites that aren't normally powered up, & I'm not usually aware of when they will be powered up.  I'm using one script as an initiator to pull the scripts from a central server.  That way I can make whatever changes on the scp servers scripts without having to coordinate with the remote sites.  Does this make sense?

 

 

Cisco Employee

It does make sense, but I

It does make sense, but I still think you should use EEM Tcl here.  You can load the remote EEM Tcl script via SCP, then register it with the EEM server, then run it using "event manager run" or action_script.  This way you get the benefit of EEM Tcl, better access control, and better CLI handling.

210
Views
0
Helpful
4
Replies
CreatePlease login to create content