cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
275
Views
0
Helpful
0
Replies
Highlighted
Beginner

EEM Multiple event variables: Neighbor-discover + MAT

I've taken bits an pieces of EEM scripts out there and put together an script to trigger an event based on "neighbor-discovery" and cdp.  The event triggers when CDP detects a switch containing a hostname.  However, I would also like to find the mac address of the switch found on that port.  It looks like I could use the $_mat_mac_address to do this, but how does one use this when also using neighbor-discovery.  I get this error "%HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: _mat_mac_address".  For now, I'm testing just putting the mac in the interface descriptions but would like to do more with it.

 

Example

event manager applet EEM_LINK_PROVISION
event tag CDP-ADD neighbor-discovery interface regexp ^GigabitEthernet cdp add
event tag CDP-DEL neighbor-discovery interface regexp ^GigabitEthernet cdp delete
trigger
 correlate event CDP-ADD or event CDP-DEL
action 001 cli command "enable"
action 002 cli command "conf t"
action 003 cli command "interface $_nd_local_intf_name"
action 010 if $_nd_notification eq "cdp-delete"
action 011 cli command "interface $_nd_local_intf_name"
action 012 cli command "no description"
action 020 elseif $_nd_notification eq cdp-add
action 021 set custom_var_cdp_entry_name "null"
action 022 regexp "^.*Switch.*$" $_nd_cdp_entry_name custom_var_cdp_entry_name
action 024 if $_regexp_result eq "1"
action 026 cli command "desc MAC: $_mat_mac_address"
action 030 exit
action 031 end
action 033 end

 

 

Everyone's tags (1)
CreatePlease to create content
Content for Community-Ad