cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
721
Views
5
Helpful
3
Replies

EEM 4.0 - cant use common variable in the applet

Hello there,

I'm trying to set an applet for auto discovery of interface description. 

(config)#event manager applet update-port-description-cdp
(config-applet)# event neighbor-discovery interface regexp HundredGigE.* cdp update
(config-applet)# action 1.0 cli command "enable"
(config-applet)# action 2.0 cli command "config t"
(config-applet)# action 3.0 cli command "interface $_nd_local_intf_name"
(config-applet)# action 4.0 cli command "description $_nd_cdp_entry_name:$_nd_port_id"

The applet is not working and the show run tells me the variable are not installed 

#show run | sec event
event manager applet update-port-description-lldp
event neighbor-discovery interface regexp TwentyFiveGigE.* lldp add
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "interface "
action 4.0 cli command "description "

Anyone had the issue ? 

3 Replies 3

Dan Frey
Cisco Employee
Cisco Employee

CDP and LLDP have different variables

INET#show event manager detector neighbor-discovery detailed 
<truncate>
	Applet Built-in Environment Variables: 
	$_event_id
	$_job_id
	$_event_type
	$_event_type_string
	$_event_pub_time
	$_event_pub_sec
	$_event_pub_msec
	$_event_severity
	COMMON VARIABLES: 
	$_nd_notification 
	$_nd_intf_linkstatus 
	$_nd_intf_linestatus 
	$_nd_local_intf_name 
	$_nd_short_local_intf_name 
	$_nd_port_id 
	CDP EVENT VARIABLES: 
        $_nd_protocol 
	$_nd_proto_notif 
	$_nd_proto_new_entry 
	$_nd_cdp_entry_name 
	$_nd_cdp_hold_time 
	$_nd_cdp_mgmt_domain 
	$_nd_cdp_platform 
	$_nd_cdp_version 
	$_nd_cdp_capabilities_string 
	$_nd_cdp_capabilities_bits 
	$_nd_cdp_capabilities_bits_[0-31] 
	LLDP EVENT VARIABLES: 
	$_nd_protocol 
	$_nd_proto_notif 
	$_nd_proto_new_entry 
	$_nd_lldp_chassis_id 
	$_nd_lldp_system_name 
	$_nd_lldp_system_description 
	$_nd_lldp_ttl 
	$_nd_lldp_port_description 
	$_nd_lldp_system_capabilities_string 
	$_nd_lldp_enabled_capabilities_string 
	$_nd_lldp_system_capabilities_bits 
        $_nd_lldp_enabled_capabilities_bits 
	$_nd_lldp_capabilities_bits 
	$_nd_lldp_capabilities_bit_[0-31] 

Hello,

what IOS are you running this on ? I somewhere remember that not all IOS versions support all variables. That said, I tested your CDP script on 15.2, and it works perfectly (with just one slight change, which is the interface, but that should not matter)...

event manager applet update-port-description-cdp
event neighbor-discovery interface regexp GigabitEthernet.* cdp update
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"

results in:

interface GigabitEthernet0/0
description Router:GigabitEthernet0/0
media-type rj45
negotiation auto

Hello Dan,

Yes, my mistake, I have 2 applets, one of CDP and one for LLDP.  I paste the config for CDP and the show run for LLDP. but its the same output for both of them. The $_ are missing in the show run.

Georg, 

IOS is : 

 

Cisco IOS XE Software, Version 17.03.05
Cisco IOS Software [Amsterdam], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 17.3.5, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2022 by Cisco Systems, Inc.
Compiled Wed 09-Feb-22 10:41 by mcpre

I successfully used this applet for 6 switches and the number 7 is not working