cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6152
Views
0
Helpful
10
Replies
Highlighted

Executing Tcl Script from Command Prompt

Hello All

Can someone please show me how to execute a tcl script from the command prompt on a cisco router?

Cheers

Carlton

Everyone's tags (4)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Hall of Fame Cisco Employee

Re: Executing Tcl Script from Command Prompt

You can only run EEM policies manually if they are registered with the none event detector.  So what you did is fine.  However, if you want to run it just to test it, have a look at https://supportforums.cisco.com/docs/DOC-12757 and scroll down to the Testing section.

View solution in original post

10 REPLIES 10
Highlighted
Rising star

Re: Executing Tcl Script from Command Prompt

Hi,

Assume that you have tcl script to ping 3 ip address as below.

foreach address {

1.1.1.1

2.2.2.2

3.3.3.3

} {ping $address}

Use "tclsh" command and copy the script. That should do the job. Please find below example.

R1#tclsh

R1(tcl)#foreach address {

+>(tcl)#1.1.1.1

+>(tcl)#2.2.2.2

+>(tcl)#3.3.3.3

+>(tcl)#} {ping $address}

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

R1(tcl)#

Hope this helps.

Regards

Najaf

Please rate when applicable or helpful !!!

Highlighted

Re: Executing Tcl Script from Command Prompt

Najaf,

As I mentioned, I think I may have figured out how to run tcl scripts, but I keep on getting the error message below....

Any thoughts?

Cheers

Highlighted

Re: Executing Tcl Script from Command Prompt

I think I've figured out how to run tcl scripts.

I have the following script on my router EmailTemplate.tcl, however when I attempt to run it using the following command I get the error mesag EmailTemplate.tcl not registered with event none Event Detector

Cheers

Carlton

Highlighted
Rising star

Re: Executing Tcl Script from Command Prompt

Hi Carlton,

Are you using any EEM? Sorry im not much in to EEM's yet :-)

You may use below url which explains how to configure EEM to send out email notifcations.

https://learningnetwork.cisco.com/blogs/network-sheriff/2009/06/19/writing-your-first-eem-applet

Regards

Najaf

Highlighted

Re: Executing Tcl Script from Command Prompt

Najaf,

That is a very good link. Unfortunately, it doesn't explain how to run tcl from within a router

Highlighted

Re: Executing Tcl Script from Command Prompt

I think I may have found the solution.

In order to run my tcl script called EmailTemplate.tcl I need to do the following int tcl mode:

Router(tcl)#source flash:EmailTemplate.tcl

The problem is I don't have the 'source' option.

Can someone please show me if there is an alternative to 'source'?

Cheers

Carlton

Highlighted
Hall of Fame Cisco Employee

Re: Executing Tcl Script from Command Prompt

This will not work.  You cannot run an EEM Tcl policy using tclsh.  What do you actually want to do?

Highlighted

Re: Executing Tcl Script from Command Prompt

Hi Joesph,

I think I figured it out. However, I wanted to be able to run a tcl script at a cisco command prompt but I kept on getting the following error message 'EmailTemplate.tcl not registered with event none Event Detector'. So after much research I tweaked the script(see attachment). I now am able to run the script at the command prompt. However, can you let me know if its the way it should be done?

Cheers

Carlton

Highlighted
Hall of Fame Cisco Employee

Re: Executing Tcl Script from Command Prompt

You can only run EEM policies manually if they are registered with the none event detector.  So what you did is fine.  However, if you want to run it just to test it, have a look at https://supportforums.cisco.com/docs/DOC-12757 and scroll down to the Testing section.

View solution in original post

Highlighted

Re: Executing Tcl Script from Command Prompt

Wow, that's a great resource. Thanks Joseph.

CreatePlease to create content
Content for Community-Ad