cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1353
Views
0
Helpful
5
Replies

EEM script to do actions on interfaces within a vlan

Joebob2
Level 1
Level 1

Hey.

 

I would like make a EEM script of sorts to i.e. shutdown all interfaces in a vlan. Say vlan 101 for instance.

My thought process would be to display all the ports in a vlan with for examples:

show vlan id 101

or

show vlan brief | sec 101

 

where I would then take all those interfaces one by one(looping through them) and do a shutdown on them.

 

But I can't quite figure out how to make a list of variables with all the interfaces to go through them one after the other to the shutdown command.

 

I imagine this being quite easy with a python script, but I would like to have an EEM command I can launch on any switch to do the shutdowns for me.

 

any help is appreciated

5 Replies 5

balaji.bandi
Hall of Fame
Hall of Fame

You can certainly achive this out of the box with Python scipting.

 

can yo explain what is the mean of Looping :

where I would then take all those interfaces one by one(looping through them) and do a shutdown on them.

You can sort interface belong to VLAN, make List UP ports and Down Ports.

 

check the down ports - make sure there is never up, or user might have disconnected for temporatly, you can do based on the traffic on the port when was the last time it seen the traffic (but shutdown you see otehr admin issue to unshut the port with user complaints)

 

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

When I use "show vlan id 101" it will give me a list of all "Gi0/X" interfaces in that vlan. I would like to through all those Gi0/X interfaces to do a shutdown on them all, one at a time. Normally I would achieve this by putting them in an array/list in another scripting language and doing the shutdown command inside each iteration of the loop. It does not matter if the ports are up or down for me.

I would like to make it with EEM, and not Python etc. The idea is to have the EEM script ready available on a switch for when I need to launch it.

Same process will work on your EEM Script, the concept is same, get VLAN associated interace and shutdown the ports .

 

some time EEM alone can not do what you looking, so in this case you may need TCL.

 

here is start with :

 

https://www.cisco.com/c/en/us/products/ios-nx-os-software/ios-embedded-event-manager-eem/index.html

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help