cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1615
Views
0
Helpful
7
Replies

EEM to Shut down FEX ports

Justin Copling
Level 1
Level 1

We are in need of using an EEM script to shut down all of the fex ports on a fex as soon as it enters the "online" state from "show fex".  Is there a good script we could use to perform this process?

 

Thanks.

7 Replies 7

Joe Clarke
Cisco Employee
Cisco Employee

How do you detect this?  Is there a syslog message?

Yes with a syslog message.  I have a script that will detect this event for a single fex, but with 8 fex's attached, I was wondering if there is a way to make this dynamic, so that it would detect the fex number and the ports that are associated with that.  The script I am running now looks like this:

event manager applet FEX101_shutdown_host_ports
  event syslog pattern "%PFMA-2-FEX_STATUS: Fex 101 is online"
  action 1.0 event-default
  action 2.0 cli config t
  action 3.0 cli interface ethernet101/1/1-48
  action 4.0 cli shutdown
  action 5.0 cli end
  action 6.0 syslog priority alerts msg EEM - Disabled all Fex 101 ports

 

Thanks.

You'd need a Python script to parse the syslog.  The easiest thing to do would be to introduce 8 applets (one for each FEX).  It's not as pretty, but it won't introduce additional management overhead.

Thanks Joe!  That is what I have done in preparation as I thought that would be the answer.  Is there a good place you can recommend I start looking at so I can figure out how to accomplish this?

Accomplish the multiple applets or the Python script?

I apologize, let me clarify.  I have the multiple applets written at this time.  I was referring to the python portion.

It depends on the specific model of Nexus switch.  For example, for the N5K, see http://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus5000/sw/python/api/python_api/getting_started.html .  To pass the variable of the syslog message to your script, use $_syslog_msg.  You can include this as a quoted argument to the script.

Review Cisco Networking for a $25 gift card