cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4329
Views
0
Helpful
22
Replies

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

This version should do what you want.

View solution in original post

22 Replies 22

Joe Clarke
Cisco Employee
Cisco Employee

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?

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

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

Thank you, Joe.  I will try this.

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.

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,

Try this version.

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,

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.

Joe,

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

Thanks,

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".

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

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.

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"

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: