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. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

Shutdown Ports Script

I'm using the TCL scripts that Joe Clarke produced in the conversation on shutting down unused ports from Aug 25. It appears like the script is running, and it even produces the susp_ports.dat file, but none of the ports are shut down. I tried it by setting the suspend_ports_days variable to 2 days, but after 4 days no ports have been shut down. Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: Shutdown Ports Script

Found the problem. This version should fix that problem.

13 REPLIES
Cisco Employee

Re: Shutdown Ports Script

Can you post your exact version of IOS, and the exact script you're using?

New Member

Re: Shutdown Ports Script

I am running C3560-IPSERVICESK9-M, Version 12.2(46)SE.

Cisco Employee

Re: Shutdown Ports Script

Post the output of:

show run | inc event manager environment

New Member

Re: Shutdown Ports Script

event manager environment suspend_ports_days 2

event manager environment suspend_ports_config flash:/susp_ports.dat

Cisco Employee

Re: Shutdown Ports Script

Okay, you have the policies configured to shutdown ports which have been operationally down for 2 days. But in the config file, these ports have only been down since 9/29 09:50:00. So they would need to still be down on 10/1 at 09:50:00 before they are shutdown.

New Member

Re: Shutdown Ports Script

I had the policy start at 00:00 on 9/26 and it has ran every day at midnight since then. Today when there were still no port shut down, I changed the cron time to 8:50 and ran it again to see if there would be some kind of error message to help troubleshoot. So, the policy has ran 5 times now, with no ports shutdown.

Cisco Employee

Re: Shutdown Ports Script

Ugh, I had a typo which I never noticed as I was catching the error. This new version should work for you.

New Member

Re: Shutdown Ports Script

Thanks, I'll give it a try and let you know the result.

New Member

Re: Shutdown Ports Script

The script ran, and there are syslog messages indicating that the ports were shutdown, but they are still enabled.

New Member

Re: Shutdown Ports Script

It looks like there is something in the script that the cli doesn't like. I turned on debug and ran the script, then advanced the clock 2 days and ran it again. The debug shows that it's trying to run "{interface FastEthernet0/1} shut" with the braces and the command is rejected. This is in lines 152 and 165 of the attachment.

Cisco Employee

Re: Shutdown Ports Script

Yeah, I have the analysis on my todo list. I should have some time to analyze the code in a little while. I'll post another update.

Cisco Employee

Re: Shutdown Ports Script

Found the problem. This version should fix that problem.

New Member

Re: Shutdown Ports Script

This works perfectly!! Thanks for your help.

2525
Views
5
Helpful
13
Replies