08-17-2015 11:39 AM
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.
08-20-2015 08:27 AM
How do you detect this? Is there a syslog message?
08-20-2015 08:32 AM
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.
08-20-2015 08:35 AM
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.
08-20-2015 08:41 AM
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?
08-20-2015 08:48 AM
Accomplish the multiple applets or the Python script?
08-20-2015 08:49 AM
I apologize, let me clarify. I have the multiple applets written at this time. I was referring to the python portion.
08-20-2015 12:03 PM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide