EEM scripting assistance: Switch, router and AP CDP

We would like to create an EEM script which will let the switch populate the interface description based on the CDP neighbour, however, we want the script to only populate the interface if (and only if) the CDP is a Cisco wireless access point (AP), a Cisco Catalyst switch and a Cisco router.   We DO NOT want the interface description to be edited if the CDP neighbour is a Cisco phone or a Cisco DMP (for example). 
This is our EEM script: 
event manager applet update-port
event none
event neighbor-discovery interface regexp GigabitEthernet.* cdp add
action 100 if $_nd_cdp_capabilities_string eq "Router" goto 200
action 110 elseif $_nd_cdp_capabilities_string eq "Switch" goto 200
action 120 if $_nd_cdp_capabilities_string eq "Switch" goto 200
action 200 cli command "enable"
action 210 cli command "config t"
action 220 cli command "interface $_nd_local_intf_name"
action 230 cli command "description $_nd_cdp_entry_name"
action 400 else
action 500 end
And this is a sample of our “sh cdp neighbor” output:
Switch#sh cdp n d
Device ID: Wireless
Entry address(es):
  IP address: <REMOVED>
Platform: cisco AIR-CAP3602I-N-K9   ,  Capabilities: Router Trans-Bridge
Interface: GigabitEthernet0/8,  Port ID (outgoing port): GigabitEthernet0.1
Holdtime : 146 sec
Version :
Cisco IOS Software, C3600 Software (AP3G2-K9W8-M), Version 15.2(2)JB, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2012 by Cisco Systems, Inc.
Compiled Mon 10-Dec-12 23:52 by prod_rel_team
advertisement version: 2
Duplex: full
Power drawn: 15.400 Watts
Power request id: 19701, Power management id: 2
Power request levels are:15400 0 0 0 0
Power Available TLV:
    Power request id: 0, Power management id: 0, Power available: 0, Power management level: 0
Management address(es):
Device ID: 00:0f:44:02:c5:29
Entry address(es):
  IP address: <REMOVED>
Platform: Cisco DMP 4310G,  Capabilities: Host
Interface: GigabitEthernet0/3,  Port ID (outgoing port): eth0
Holdtime : 157 sec
Version :
5.4
advertisement version: 2
Duplex: full
Power Available TLV:
    Power request id: 0, Power management id: 0, Power available: 0, Power management level: 0
Management address(es):
Device ID: CALM040.mgmt.educ
Entry address(es):
  IP address: <REMOVED>
Platform: cisco WS-C3750E-24PD,  Capabilities: Switch IGMP
Interface: GigabitEthernet0/10,  Port ID (outgoing port): GigabitEthernet1/0/22
Holdtime : 126 sec
Version :
Cisco IOS Software, C3750E Software (C3750E-UNIVERSALK9-M), Version 15.0(2)SE, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2012 by Cisco Systems, Inc.
Compiled Fri 27-Jul-12 23:26 by prod_rel_team
advertisement version: 2
Protocol Hello:  OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF0000000000000023AC075300FF0000
VTP Management Domain: 'ACTEducation'
Native VLAN: 99
Duplex: full
Power Available TLV:
    Power request id: 0, Power management id: 1, Power available: 0, Power management level: -1
Management address(es):
  IP address: <REMOVED>
Device ID: 00:0f:44:02:b6:31
Entry address(es):
  IP address: <REMOVED>
Platform: Cisco DMP 4310G,  Capabilities: Host
Interface: GigabitEthernet0/2,  Port ID (outgoing port): eth0
Holdtime : 169 sec
Version :
5.4
advertisement version: 2
Duplex: full
Power Available TLV:
    Power request id: 0, Power management id: 0, Power available: 0, Power management level: 0
Management address(es):
Best Regards/Leo

action 221 regexp "^([^\.])\." $_nd_cdp_entry_name match hostaction 230 cli command "description $host"
Hi Joe,
So the EEM is going to look like this: 
event manager applet update-port
event neighbor-discovery interface regexp GigabitEthernet.* cdp add
action 100 regexp "(Switch|Router)" $_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
Is this correct?

Similar Messages

  • EEM Script to reload router only once after tracked object is down.

    event manager applet vpn_tunnel_unreachable
    event track 456 state down
    action 1.0 reload
    I need it to reload only once if tracked object 456 is down. It should reload the router and then if the tracked object is still down it should go into dial backup as it normally would if it did not have the reload script.

    I suggest reposting this question at the other Network Management subforum under Network Infrastructure to get the attention of the resident EEM guru.
    http://forum.cisco.com/eforum/servlet/NetProf?page=netprof&forum=Network%20Infrastructure&topic=Network%20Management&CommCmd=MB%3Fcmd%3Ddisplay_messages%26mode%3Dnew%26location%3D.ee71a02

  • EEM script to Reload router 1 Time if Dial Fails

    We have a script we use to track objects and if access to these objects fails we reload the router 1 time (see it below). We want to now apply the same script in a different capacity for another customer for dial. If the router fails to connect after trying to round robin thru 4 toll free 800 numbers then reload the router.
    event manager applet vpn_tunnel_rebooter
    event none
    action 1.0 cli command "enable"
    action 2.0 cli command "config t"
    action 3.0 cli command "no event manager applet vpn_tunnel_unreachable"
    action 4.0 cli command "end"
    action 5.0 cli command "write mem"
    action 6.0 reload
    event manager applet vpn_tunnel_up
    event track 456 state up
    action 001 cli command "enable"
    action 002 cli command "config t"
    action 003 cli command "event manager applet vpn_tunnel_unreachable"
    action 004 cli command "event track 456 state down"
    action 005 cli command "action 1.0 policy vpn_tunnel_rebooter"
    action 006 cli command "end"
    Any ideas on how we might accomplish this? I have very little EEM experience :)
    1) Current Object tracking tracks 3 objects, If access to all three is down we go into a 180 sec delay down timer. If they remain down we switch over to dial backup.
    2) We round robin between 4 dial numbers and if access to all 4 fails, we want to reload router "ONE" time
    3) When it comes back up and objects are still unavailable we attempt to dial the 4 numbers again and if it also fails to connect "DO NOT" reload this time.

    Okay, these policies should do what you want. They are all untested as I do not have a dial backup setup. First, you need to register the following applets:
    event manager applet remove-dial-backup-watch
    event syslog pattern "SYS-5-RESTART"
    action 1.0 cli command "enable"
    action 2.0 cli command "config t"
    action 3.0 cli command "no event manager policy tm_check_dial_backup.tcl"
    action 4.0 cli command "end"
    event manager applet watch-track-down
    event track 456 state down
    action 1.0 syslog msg "Track 456 is down, waiting to see if dial backup comes up"
    action 2.0 cli command "enable"
    action 3.0 cli command "config t"
    action 4.0 cli command "event manager policy tm_check_dial_backup.tcl"
    action 5.0 cli command "end"
    event manager applet watch-track-up
    event track 456 state up
    action 1.0 syslog msg "Track 456 is up, removing dial backup watcher"
    action 2.0 cli command "enable"
    action 3.0 cli command "config t"
    action 4.0 cli command "no event manager policy tm_check_dial_backup.tcl"
    action 5.0 cli command "end"
    Then, you need to set an environment variable for the Tcl policy:
    dial_backup_numbers : Comma-separated list of numbers to check
    For example:
    event manager environment dial_backup_numbers 18667143757,18003179379,18886601039,18004434603
    Then INSTALL but do NOT register the attached Tcl policy. That is, copy the attached Tcl policy to your EEM user policy directory, but do not register it.
    Then everything should just work.

  • Need Help with EEM script for monitoring Rx and Tx load on Link

    Hello,
    I'm trying to implement a script, which monitors the Tx and Rx Load on the Link and sends a syslog in case the load is exceeded 200 mark (i.e If Rx or Tx load > 200)
    I have implemented the following script. But it is not giving the required results.
    event manager applet test
    event interface name Tunnel111 parameter rxload entry-val 200 entry-op gt entry-val-is-increment true poll-interval 5000
    action 1.0 syslog msg "Increase Load On the Link"
    I'm trying to monitor the load on Tunnel 111 which is mapped to WAN interface.
    Router (Cisco 2821) has following IOS
    c2800nm-advipservicesk9-mz.124-25g.bin

    Hello Joseph,
    As per your suggestion, we made some changes in our script and the following script is working fine. Its giving the required syslogs when the load is exceeded.
    event manager applet test
    event interface name Tunnel111 parameter txload entry-val 200 entry-op gt entry-val-is-increment false poll-interval 5
    action 1.0 syslog msg "Increased Load On the Link"
    Your prompt assistance is really appriciated.

  • EEM Script - Check BGP Neighbors and shutdown interfaces

    Hello,
    We have one router with 2 links to same ISP. We have 1 bgp neighbor for each link.
    So, at this router we have 2 links and 2 neighbors with same ISP. And this router have conections with a router reflector
    First, we are trying shutdown the router links with router reflector if both neighbor is down. I did this script attached. It´s hard to test it because we will use in 7600 routers. We tested it once and it didnt work as expectted. The variable didn´t work very well...
    Any tips? Is this wrong??
    Thanks.

    Hello,
    We have one router with 2 links to same ISP. We have 1 bgp neighbor for each link.
    So, at this router we have 2 links and 2 neighbors with same ISP. And this router have conections with a router reflector
    First, we are trying shutdown the router links with router reflector if both neighbor is down. I did this script attached. It´s hard to test it because we will use in 7600 routers. We tested it once and it didnt work as expectted. The variable didn´t work very well...
    Any tips? Is this wrong??
    Thanks.

  • EEM script not running in WS-C4900M switch

    Hello,
    I am having  two WS-C4900M switches which were giving high cpu spikes hence we have configured EEM script in it to capture switch behaviour during cpu spikes.when  CPU goes high script do get hit but the commands under script doesn't run and we are not able fecth command outputs during high cpu.
    Pleas find script uploaded and show version of switch attached.

    I don't think you need a script for this.  An applet should work just fine.  This kind of thing is commonly done by TAC to aid in data collection for transient problems.  This policy should work provided the CPU instance is correct.  A 7600 will have at least two CPUs.  This applet assumes CPU instance 1 is the desired CPU, but it may be CPU instance 2 you need to monitor.
    event manager applet watch-cpu event snmp oid 1.3.6.1.4.1.9.9.109.1.1.1.1.11.1 get-type exact entry-op ge entry-val 90 exit-op lt exit-val 90 poll-interval 60 maxrun 300 action 1.0 cli command "enable" action 1.1 cli command "term exec promp time" action 2.0 cli command "show tech | append disk0:/high_cpu.txt" action 3.0 cli command "sh ip bgp vpnv4 vrf VRF10102 neighbors | append disk0:/high_cpu.txt" action 4.0 cli command "sh bgp vpnv4 unicast vrf VRF10102 summary | append disk0:/high_cpu.txt" action 5.0 cli command "sh ip  bgp vpnv4 vrf VRF10102 neighbors x.x.x.x advertised-routes | append disk0:/high_cpu.txt" action 6.0 cli command "sh ip  bgp vpnv4 vrf VRF10102 neighbors x.x.x.x received-routes | append disk0:/high_cpu.txt" action 7.0 cli command "sh isis neighbors detail | append disk0:/high_cpu.txt" action 8.0 cli command "show logg | append disk0:/high_cpu.txt"

  • I set up a new router and the windows machines have no problem with connectivity.  I go through the MacBook Pro's airport assistant and view my network and then enter the WPA2 password.  I get back a message saying the password is incorrect when it is

    I set up a new router and the windows machines connect fine.  My MacBook Pro does not.  I go through the airport assistant and see the network yet when I enter the router WPA password I get a message back saying that the password is incorrect.  And, it isn't!  Very frustrating.  What can I do as I had the same problem after I tried to reinstall my last router.  Again, only on the Mac.  Thanks!

    If you kept the same Base Station name and network name, that can confuse Keychain Access. Either change the Base Station and network name, or open Keychain Access Utility and delete any reference to your Base Station and network name. Make sure you delete from the Login and System keychains.

  • A 10/100 Router and a gigabit switch...will they get along?

    I am setting up my business network between multiple computers. I need gigabit speeds for large file transfers (video, audio, images), but I also need internet connectivity. I was planning on using a simple 10/100 4 port broadband router and a Netgear Prosafe 24 port 10/100/1000 gigabit switch. If I connect the router to the switch, will my network's performance decrease since the router is responsible for assigning ip addresses, or will the switch's gigabit speeds still work within my network (since switches operate using MAC addresses)? Can anyone help me on this one? Thank you!
    P.S. --It's also between Mac and Window systems
    Powerbook G4 17"   Mac OS X (10.4.7)  

    If the devices plugged into the gig-switch have gigabit ethernet ports, then you will see a speed advantage over 100mbps performance. I have a similar setup, with a 4-port linksys router that is 10/100 and an 8-port linksys gig-switch connected to it. I connect my printer and VOIP adapter directly to the router, since they aren't gig anyway, and connect my other devices to the gigabit switch.

  • Link b/w router and switch

    I am useing 2600 series router and trying to link it with a 2950 switch,
    2950 switch is attached with a internet connection & layer 3 switches, 2600 series router is connecting with 2950 at the client permises, what will be the port configuration at both 2950 & 2600 series devices,
    currently i configure sw mod trunk at 2950,
    and IP at the fastethernet port of 2600 series router.
    But when ever i try to telnet the router it cannot telnet

    What VLAN are the devices from which you wish to telnet to the router ?
    You need to configure the router as follows:
    interface fastethernet0/1.10
    encapsulation dot1q
    ip address
    Where VLAN is the VLAN you want to get to the router from ...
    Pls do remember to rate posts.
    Paresh

  • Arp aging time on router and mac address aging time on switches set close t

    Hi,
    appreciate some advice on the following:
    what is the benefit of setting arp aging time on router and mac address aging time on switches close to each other?
    Thanks,
    Christina

    Hi,
    based on the below output, do you think implementing it will benefit? Thanks.
    C2950#sh int fa0/43
    FastEthernet0/43 is up, line protocol is up (connected)
    Hardware is Fast Ethernet, address is 000d.5e11.4e2b (bia 000d.5e11.4e2b)
    MTU 1500 bytes, BW 100000 Kbit, DLY 1000 usec,
    reliability 255/255, txload 7/255, rxload 2/255
    Encapsulation ARPA, loopback not set
    Keepalive set (10 sec)
    Full-duplex, 100Mb/s
    input flow-control is off, output flow-control is off
    ARP type: ARPA, ARP Timeout 04:00:00
    Last input never, output 00:00:00, output hang never
    Last clearing of "show interface" counters never
    Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
    Queueing strategy: fifo
    Output queue: 0/40 (size/max)
    5 minute input rate 933000 bits/sec, 149 packets/sec
    5 minute output rate 2981000 bits/sec, 263 packets/sec
    2819781393 packets input, 3782332886 bytes, 0 no buffer
    Received 266693 broadcasts (0 multicast)
    0 runts, 0 giants, 0 throttles
    0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
    0 watchdog, 0 multicast, 0 pause input
    0 input packets with dribble condition detected
    4015025747 packets output, 2328228393 bytes, 0 underruns
    0 output errors, 0 collisions, 2 interface resets
    0 babbles, 0 late collision, 0 deferred
    0 lost carrier, 0 no carrier, 0 PAUSE output
    0 output buffer failures, 0 output buffers swapped out
    C2950#

  • Need script can switch Offfice 365 plan E1 to E3 and enable litigation hold from CSV file

    Dear all,
    Currently, i need a script can switch Office 365 plan E1 to E3 and enbale litigation hold from the list email in CSV file. I don't know why Microsoft is not enable litigation hold for E3 user by default? Please help me.
    Many thanks.

    You should try like this
    $mbxs = Import-csv C:\Temp\Mailbox.csv
    foreach($mbx in $mbxs.UPN)
    Set-MsolUserLicense -UserPrincipalName $mbx -RemoveLicenses '<E1>' -AddLicenses '<E3>' -Verbose
    Set-Mailbox -Identity $mbx -LitigationHoldEnabled $true -WhatIf
    Please test with one test account and explore office 365 community as well.
    Regards Chen V [MCTS SharePoint 2010]

  • For some weird reason now, every time I try to open a LinkedIn page it seems to get re-routed to a UPS page. Did I inadvertently trigger a script of some kind and, if so, how do I un-do it?

    For some weird reason now, every time I try to open a LinkedIn page in Safari it seems to get re-routed to a UPS page. Did I inadvertently trigger a script of some kind and, if so, how do I un-do it? This happens, no matter what the LinkedIn page is.

    Hi ...
    From your Safari menu bar click Safari > Empty Cacche. Quit then relaunch Safari to test.
    If that didn't help, go to ~/Library/Caches/com.apple.Safar/Cache.db
    Move the Cache.db file from the com.apple.Safari folder to the Trash.
    Quit then relaunch Safari to test.
    Doubtful just visiting a page in within the LinkedIn site triggers a script of any kind.

  • Power consumption for router and switch

    I have a linksys EZSX88W switch which I checked power consumption of 70ma idle. It's supplied by the adapter which has an output of 1000ma. Not sure what the consumption when switch is being used. I also have an WRT54GS but haven't checked consumption yet, but it's powered by the same 1000ma adapter. In an effort to save energy-that -GREEN FEELING- I was thinking of using on power adapter to power bothe the router and switch. Has anyone tried this yet?? Also if I posted this in the wrong area I hope the moderator will move the post.
    thanks

    So you are thinking of Powering on both the Devices using a single Power Adapter? Well never tried to make both the devices use a single power adapter. As far as i think its not possible. But if you still wish, you can give a try and check if that works for you or not.

  • Configure DHCP on router and switch

    Good afternoon,
      I'm trying to configure DHCP using CLI on a 2610 router and 2950 switch.  With my present config, the host at the end of the switch (configured to receive ip via DHCP) is not getting anything assigned.  Here are some shows:
    Router:
    Router_1#show ip int br
    Interface                  IP-Address         OK?   Method   Status                        Protocol
    FastEthernet0/0       192.168.10.1      YES   manual    up                              up   (leading to switch)
    Serial0/0                  unassigned         YES   unset      administratively down  down
    Serial0/1                  unassigned         YES   unset      administratively down  down
    Ethernet1/0              unassigned         YES   unset      administratively down  down
    Ethernet1/1              unassigned         YES   unset      administratively down  down
    Ethernet1/2              unassigned         YES   unset      administratively down  down
    Ethernet1/3              unassigned         YES   unset      administratively down  down
    Router_1#show ip dhcp pool
    Pool acer_pool :
    Utilization mark (high/low)   : 100 / 0
    Subnet size (first/next)       : 0 / 0
    Total addresses                : 254
    Leased addresses            : 0
    Pending event                   : none
    1 subnet is currently in the pool :
    Current index        IP address range                              Leased addresses
    192.168.10.1       192.168.10.1     - 192.168.10.254                   0
    Switch:
    Switch_1#show ip int br
    Interface                      IP-Address      OK?     Method      Status        Protocol
    Vlan1                           unassigned      YES     NVRAM     up              up
    FastEthernet0/1            unassigned      YES     unset         up             up      (leading to router)
    FastEthernet0/2            unassigned      YES     unset         down         down
    FastEthernet0/3            unassigned      YES     unset         down         down
    FastEthernet0/4            unassigned      YES     unset         down         down
    FastEthernet0/5            unassigned      YES     unset         down         down
    FastEthernet0/6            unassigned      YES     unset         down         down
    FastEthernet0/7            unassigned      YES     unset         down         down
    FastEthernet0/8            unassigned      YES     unset         down         down
    FastEthernet0/9            unassigned      YES     unset         down         down
    FastEthernet0/10          unassigned      YES     unset         down         down
    FastEthernet0/11          unassigned      YES     unset         down         down
    FastEthernet0/12          unassigned      YES     unset         down         down
    FastEthernet0/13          unassigned      YES     unset         down         down
    FastEthernet0/14          unassigned      YES     unset         down         down
    FastEthernet0/15          unassigned      YES     unset         down         down
    FastEthernet0/16          unassigned      YES     unset         down         down
    FastEthernet0/17          unassigned      YES     unset         down         down
    FastEthernet0/18          unassigned      YES     unset         down         down
    FastEthernet0/19          unassigned      YES     unset         down         down
    FastEthernet0/20          unassigned      YES     unset         down         down
    FastEthernet0/21          unassigned      YES     unset         down         down
    FastEthernet0/22          unassigned      YES     unset         up             up
    FastEthernet0/23          unassigned      YES     unset         down         down
    FastEthernet0/24          unassigned      YES     unset         down         down
    What other info can I supply to resolve this?
    Thanks.

    Hi Moh,
      First, thanks for pointing out that I'm in the wrong section of the forums.  My bad.  I'll pay closer attention next time.
      Second, I tried your suggestion but it failed to work.  I cleared the configs of the router so I could start with a clean slate and followed your commands to the letter.  The host can't seem to get an IP assigned and the here's what I get with a Show IP DHCP Pool:
    Router_1#show ip dhcp pool
    Pool vlan1 :
     Utilization mark (high/low)    : 100 / 0
     Subnet size (first/next)       : 0 / 0
     Total addresses                : 254
     Leased addresses               : 0
     Pending event                  : none
     1 subnet is currently in the pool :
     Current index        IP address range                    Leased addresses
     192.168.10.1         192.168.10.1     - 192.168.10.254    0
      Am I missing something?

  • Syslog for router and switch

    Hi all,
             Any one help me to configure router and switch log on windows server. I dont have any idea please send me link or guide to configure syslog server on windows.  For PPTP vpn users also.

    Hi,
    Are you asking, "How do I set up my Windows server as a Syslog Server"... in order to receive messages from your routers and switches?
    If so, I'd suggest a google search on syslog server - locate and download the software there, and it should have a configuration guide with it.
    Was this the information you were looking for?
    Curtis

Maybe you are looking for