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

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

1 Accepted Solution

Accepted Solutions

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

kcnajaf
Level 7
Level 7

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 !!!

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

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

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

Najaf,

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

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

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

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

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.

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

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: