05-04-2014 07:39 PM
I've been using THIS, which Joe has modified. The script checks the CDP table and only works on routers, switches and wireless access points. The problem is that the access point doesn't seem to work. Here's Joe's script:
event manager applet update-port event neighbor-discovery interface regexp GigabitEthernet.* cdp add action 100 regexp "(Switch|Router|Trans-Bridge)" "$_nd_cdp_capabilities_string" action 110 if $_regexp_result eq "1" action 200 cli command "enable" action 210 cli command "config t" action 220 cli command "interface $_nd_local_intf_name" action 230 regexp "^([^\.]+)\." "$_nd_cdp_entry_name" match host action 240 cli command "description $host" action 500 end
And the error I am getting is:
May 5 12:23:48 AEST: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: host May 5 12:23:48 AEST: %HA_EM-3-FMPD_ERROR: Error executing applet update-port statement 240
The "sh cdp neighbors detail" result of a wireless access point is:
Device ID: Device Entry address(es): IP address: 10.227.99.249 Platform: cisco AIR-LAP1142N-N-K9, Capabilities: Router Trans-Bridge Interface: GigabitEthernet4/48, Port ID (outgoing port): GigabitEthernet0.1 Holdtime : 158 sec Version : Cisco IOS Software, C1140 Software (C1140-K9W8-M), Version 15.2(4)JB4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2014 by Cisco Systems, Inc. Compiled Thu 06-Mar-14 11:37 by prod_rel_team advertisement version: 2 Duplex: full Power drawn: 15.400 Watts Power request id: 33353, Power management id: 2 Power request levels are:15400 14500 0 0 0 Management address(es):
Would appreciate if someone can help me fix this.
Thanks in advance.
Solved! Go to Solution.
05-06-2014 10:39 AM
There is no trailing dot. So you need to use a regexp of either:
"^([^\.]+)\.?"
Or:
"^([^\.]+)"
05-05-2014 10:59 AM
If you're ID is really
Device ID: Device
Then your regexp won't match. You could likely add a '?' at the end of the pattern to indicate the trailing '.' is not required.
05-05-2014 03:12 PM
Joe,
I substituted the Device ID of the wireless access point. Device ID is the hostname of the wireless access point which has the following syntax: SITEasset.
Best Regards/Leo
05-05-2014 03:32 PM
If you print the value of $_nd_cdp_entry_name, what do you get? Do not sanitize this as it will be important to see why the regexp is not matching.
05-05-2014 03:49 PM
If you print the value of $_nd_cdp_entry_name, what do you get?
Hi Joe,
Thanks.
EEM is totally out of my league here. How do I "print the value of $_nd_cdp_entry_name"?
05-05-2014 03:50 PM
Add:
action 221 syslog msg "XXX: '$_nd_cdp_entry_name'"
05-05-2014 03:59 PM
May 6 08:56:54 AEST: %HA_EM-6-LOG: update-port: XXX: 'CLRM197230' May 6 08:56:54 AEST: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: host May 6 08:56:54 AEST: %HA_EM-3-FMPD_ERROR: Error executing applet update-port statement 240
Un-sanitized output above, Joe.
Thanks for sharing your expertise here.
05-06-2014 10:39 AM
There is no trailing dot. So you need to use a regexp of either:
"^([^\.]+)\.?"
Or:
"^([^\.]+)"
05-06-2014 05:39 PM
This is in line 230, right Joe?
I'll give this a try tomorrow.
Thanks Joe!
05-07-2014 06:04 PM
Thanks Joe. It's working.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: