Showing results for 
Search instead for 
Did you mean: 

Community Helping Community

Automatically Set Port Descriptions


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


Several possible way to do this.

While the applet is "installed" and using the "cdp add" event do one of the following to add any neighbors:

1) shut/no shut pr interface

2) Change the hostname of remote switch/router

3) "no cdp enable"/"cdp enable" pr interface

4) In enable mode, do a "clear cdp table"

All of these will create a "cdp add" event, and thus trigger the script to run.


Tommy V

Hall of Fame Cisco Employee

It sounds like what would be easiest for you is to configure the applet with an "add" event, then just do a clear on the CDP table.  You'd only need to do that once.  After that, the applet will notice all new neighbors.


Thanks all for your support and suggestions.... it worked by clearing the CDP table...


i'm trying to implement this on a 4507 with IOS 15.1(1)SG1

the problem seem to be that only the activ sup is having the CDP table

F1K1-bb(config-applet)#event neighbor-discovery interface regexp .*Ethernet[1-9]/[0-9]/[0-9]+$ cdp add
%ERROR: Standby doesn't support this command
% Incomplete command.


Mod Ports Card Type                              Model         
 1    24  1000BaseX (SFP)                        WS-X4624-SFP-E
 2    24  1000BaseX (SFP)                        WS-X4624-SFP-E
 3     6  Sup 6L-E 10GE (X2), 1000BaseX (SFP)    WS-X45-SUP6L-E
 4     6  Sup 6L-E 10GE (X2), 1000BaseX (SFP)    WS-X45-SUP6L-E 
 5    48  10/100/1000BaseT Premium POE E Series  WS-X4648-RJ45V+E
 6    48  10/100/1000BaseT Premium POE E Series  WS-X4648-RJ45V+E
 7    48  10/100/1000BaseT Premium POE E Series  WS-X4648-RJ45V+E


Hall of Fame Cisco Employee

You get this error when you try to configure this on the active sup of a dual-sup 4500?


yes that's correct

Hall of Fame Cisco Employee

This looks like CSCtx99469.  It is fixed in 15.1(2)SG4.


i have a maintenance window at the of next month.

i will update and test again.


Same bug in 03.06.00E ( 15.2(2)SE ) on Catalyst 3850....Also on the 03.03.xx series of SW for the 3850.

I actually don't have sufficient privileges to see the bug. So can anyone tell me when it will be fixed on 3850, and 4500 Sup 8 (if affected)? 


well looks like it is not fixed in 15.2.(2)

i just updated but no luck

(config-applet)#event neighbor-discovery interface regexp .*GigabitEthernet[0-9]/[0-9]+$ cdp add
%ERROR: Standby doesn't support this command
% Incomplete command.


Hall of Fame Cisco Employee

Looks like another related bug was just opened dealing with events using regular expressions (CSCuq41312).  This one is still open.  So the problem will persist in certain situations.

Community Member

Any Ideas how I may be able to implement something similar to this on a Nexus 3048?

I would like to do this based on the LLDP neighbors rather than CDP, so that when an SNMP trap is received it provides the hostname. The trouble I am having is the difference in the syntax between the EEM version here and the one on the 3048 I am trying to implement it on.

Hall of Fame Cisco Employee

Unfortunately, this won't work on NX-OS as the neighbor-discovery event detector is not yet on that OS.

Community Member

Would CDP neighbor-discovery work on this device, or is there no neighbor-discovery capibility at all? Is there any way that port descriptions can automatically be updated on a Nexus 3048 through an Applet similar to the one you have created?

Hall of Fame Cisco Employee

While NX-OS supports CDP, it does not support the ability to react to changes in the CDP neighbor table like IOS does.  Therefore, you would not be able to use this applet to set port descriptions.  Other than using the NX-OS scheduler to run periodically and parse the CDP neighbor table with a Tcl or Python script, I can't think of a way to do this on NX-OS.

CreatePlease to create content
Content for Community-Ad
FusionCharts will render here