event manager environment email_to ywang@xyz.com
event manager environment email_server xxx.xxx.xxx.xxx
event manager session cli username "xyz"
event manager applet cdp-neighbor-down
description track device down from cdp event
event neighbor-discovery interface regexp FastEthernet cdp delete
action 1.0 info type routername
action 2.0 mail server "$email_server" to "$email_to" from "eem@$_info_routername" subject "$_nd_cdp_entry_name Down" body "$_event_pub_time: $_nd_cdp_entry_name down at $_nd_local_intf_name"
event manager applet cdp-neighbor-up
description track device up from cdp event
event neighbor-discovery interface regexp FastEthernet cdp add
action 1.0 info type routername
action 2.0 cli command "enable"
action 3.0 cli command "config t"
action 4.0 cli command "interface $_nd_local_intf_name"
action 5.0 cli command "description $_nd_cdp_entry_name:$_nd_port_id"
action 6.0 mail server "$email_server" to "ywang@xyz.com" from "eem@$_info_routername" subject "$_nd_cdp_entry_name Up" body "$_event_pub_time: $_nd_cdp_entry_name Up at $_nd_local_intf_name"
--https://supportforums.cisco.com/docs/DOC-24529
In preparing for CiscoLive! in San Diego, I am provisioning our access layer 3560-E switches. Since things have a tendency to change a lot at an event like CiscoLive! I thought it would be best to make sure our port descriptions are always up-to-date when it comes to reflecting what devices are connected. To help me do that, I wrote up this small EEM applet policy. It will update the port's description based on the CDP neighbor learned on that port. This policy requires EEM 3.2, so you're looking at 12.2(55)SE or higher for the 3560s. It will also work on 3750s and ISR G2 routers running 15.x code.
event manager applet update-port-description
event neighbor-discovery interface regexp GigabitEthernet.* cdp add
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "interface $_nd_local_intf_name"
action 4.0 cli command "description $_nd_cdp_entry_name:$_nd_port_id"
The result of this will be a description like the following on switch ports:
description SDCC_IDF_1.11:TenGigabitEthernet0/1
No comments:
Post a Comment