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

TCL Script on interface down

Hello,

I was reffered to this discussion board by cisco support. We are troubleshooting an issue with cisco 7609 and need to create TCL script that does the following.

Tracks interface status and on down state executes 'show log' , 'show tech' ..... all the output needs to be saved into a file

In additon show commands needs to be executed from SIP-200 card ('attach 4' is the command to get there)

I created EEM applet but it turned out that to get to SIP-200 card TCL script is required.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: TCL Script on interface down

This version should do what you want.

22 REPLIES
Cisco Employee

Re: TCL Script on interface down

What version of IOS does this need to run on?  Exactly what commands need to be run on the Sup and on the line card?

New Member

Re: TCL Script on interface down

Version  12.2(33)SRD3

Sup commands:

A. show log
B. show controllers serial 4/0/0/3:0 [5 times, pause 15 seconds between outputs]
C.show interface serial 4/0/0/3:0  [5 times, pause 15 seconds between outputs]
D. show hqf interface [5 times, pause 15 seconds between outputs]
E. show policy-map interface serial 4/0/0/3:0  [5 times, pause 15 seconds between outputs]
F. show tech

From SIP-200 [In this order]:
=============================
A. show platform software camp [5 times, pause 15 seconds between outputs]
B. show proc cpu [5 times, pause 15 seconds between outputs]
C. show platform software ibc [5 times, pause 15 seconds between outputs]
D. show plat hard egos counters [5 times, pause 15 seconds between outputs]
E. show platform hardware spi4 spa0  [5 times, pause 15 seconds between outputs]
F. show interfaces [5 times, pause 15 seconds between outputs]
G. show controllers [5 times, pause 15 seconds between outputs]
H. sh platform hardware hyperion all [5 times, pause 15 seconds between outputs]
I. sh platform hardware hyperion counters [5 times, pause 15 seconds between outputs]
J. sh platform hardware hyperion errors [5 times, pause 15 seconds between outputs]
K. sh platform hardware hyperion packet [5 times, pause 15 seconds between outputs]
L. sh platform hardware sonet [5 times, pause 15 seconds between outputs]
M. sh platform hardware iofpga [5 times, pause 15 seconds between outputs]
N. sh platform hardware ssa brief [5 times, pause 15 seconds between outputs]
O. sh platform hardware ssa counters [5 times, pause 15 seconds between outputs]
P. sh platform hardware ssa status [5 times, pause 15 seconds between outputs]  
Q. sh platform hardware eos brief [5 times, pause 15 seconds between outputs]
R. sh platform hardware eos counters [5 times, pause 15 seconds between outputs]
S. sh platform hardware eos status [5 times, pause 15 seconds between outputs]

Thanks

Cisco Employee

Re: TCL Script on interface down

I believe this script will do what you want.  You will need to set some EEM environment variables before you can use it.

# check_intf      : Name of the interface to watch.

#

# check_intf_file : Full patch to the file into which the command output

#                   will be saved.

#

# check_intf_mod  : Module from which additional CLI output will be collected.

For example:

event manager environment check_intf Serial4/0/0/3:0

event manager environment check_intf_file disk0:/cli_output.txt

event manager environment check_intf_mod 4

The policy must then be copied to the switch.  I typically create a directory called "policies" on one of the local flash file systems (e.g. disk0:/policies).  After creating the directory, copy the sl_check_intf.tcl policy into this directory.  Finally, after configuring the environment variables above, configure the following:

event manager directory user policy disk0:/policies

event manager policy sl_check_intf.tcl

New Member

Re: TCL Script on interface down

Thank you, Joe.  I will try this.

Cisco Employee

Re: TCL Script on interface down

I didn't have a module with which to test other than the SP module of my 7600.  If you're using this to connect to an ESM card, for example, you may run into problems.  Here is a better version which should work more reliably.

New Member

Re: TCL Script on interface down

Thanks Joe. I also need to remove a service policy once all show commands are done.

I tried adding a script into your file, but .....

Could you help me with that. Here are the commands:

conf t

interface serial 4/0/0/3:0

no service-policy output Parent

Thanks,

Cisco Employee

Re: TCL Script on interface down

Try this version.

New Member

Re: TCL Script on interface down

Joe,

I tested the script few times. The ouput fie has only the results of show commands from the privilage mode.

'show policy-map interface serial 4/0/0/3:0' is the last one (5 times)

'Show tech' and commands from the module are not there.

Thanks,

Cisco Employee

Re: TCL Script on interface down

Do you see any messages in show logg?  I allowed this policy to run for an hour, so I don't think it's being terminated before the show tech.  If you can, collecting the output of "debug event manager tcl cli" would be helpful.

New Member

Re: TCL Script on interface down

Joe,

Attached is the debug output.Looks like IOS is waiting for something after 'attach 4' command. Carriage return? It just sits there.

Thanks,

Cisco Employee

Re: TCL Script on interface down

You're using the wrong version of the script.  Make sure you download the LAST version in this thread.  I changed the attach approach to "remote command".  Check the script to make sure you see "remote command" and not "attach".

New Member

Re: TCL Script on interface down

I checked and file was correct. Just in case I deleted it and uploaded again. Checked the contect of the file on the router and it has 'remote command'. Tested it again and got the same result. Do I need to re-register the script or do something else to activate the new script?

Thanks

Cisco Employee

Re: TCL Script on interface down

Yes, you must always re-register EEM Tcl policies when you make a change.  Simply copying the new policy file to the device is not sufficient.  Just unconfigure the policy, and reconfigure it, and that will sufficiently re-register it.

New Member

Re: TCL Script on interface down

Got it. It's running the new script now. But still cannot get output from the module 4. Here is what debug command shows :

.

.

2083110: 21w5d: %HA_EM-6-LOG: sl_check_intf.tcl : DEBUG(cli_lib) : IN  : 7600rtr#remote command module 4 show platform hardware sonet | append sup-bootdisk:ser4003_shut.txt
2083111: 21w5d: %HA_EM-6-LOG: sl_check_intf.tcl : DEBUG(cli_lib) : OUT : $atform hardware sonet | append sup-bootdisk:ser4003_shut.txt
2083112: 21w5d: %HA_EM-6-LOG: sl_check_intf.tcl : DEBUG(cli_lib) : OUT : Cannot remote to module 4

.

.

I tried running 'remote command module 4 show ..' manualy from the privilieage mode and got the same error "cannot remote to module 4"

Cisco Employee

Re: TCL Script on interface down

But attach works?  What type of module is this?

New Member

Re: TCL Script on interface down

That is SIP -200, model# SPA-4XCT3/DS0

Yes, attach 4 works, though after executing attach 4 command system gives the following prompt:

7600rtr#attach 4
Entering CONSOLE for slot 4
Type "^C^C^C" to end this session

And carriage return is expected. From there 'enable' command is required to get to the privilege mode on module 4

Thank you,

Cisco Employee

Re: TCL Script on interface down

I didn't have a SIP-200, but I adapted my policy to work with "attach" on a SIP-600.  Give this version a shot.

New Member

Re: TCL Script on interface down

Interesting, I ran it few times but never got output on show commands from module 4. Attached is TCL debug,it looks like correct commands are executed but there is no ouptut. Any ideas?

Thanks,

Cisco Employee

Re: TCL Script on interface down

I think I needed to do a "term len 0" on the SIP module.  I don't have my test SIP handy at the moment to confirm, but try this version, and see if it works.

New Member

Re: TCL Script on interface down

Great. That worked just perfect. The only problem is, it takes too long to execute all those commands. Interface stays down till all the commands are done and service-policy is removed.

Would it be possible to run all the module commands at once, pause for 15 sec and run them again(5 times), as suppose to pausing 15 sec after each command. That should save us a lot of time. Sorry should have though about this before.

Thanks

Cisco Employee

Re: TCL Script on interface down

This version should do what you want.

New Member

Re: TCL Script on interface down

Great. Thanks a lot.

1736
Views
0
Helpful
22
Replies