11-11-2016 08:59 AM - edited 03-05-2019 07:28 AM
Does anyone know if there is way to write a script to automatically clear active routes in the sh ip eigrp topology active command?
example would be:
sh ip eigrp topo active
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
A 123.123.123.124/30, 0 successors, FD is 77056, tag is 13979
1 replies, active never, query-origin: Local origin
via 192.168.101.193 (77056/76800), Port-channel9
via 192.168.101.114 (Infinity/Infinity), Port-channel6, serno 9991525
via 172.16.0.22 (77312/77056), r, TenGigabitEthernet1/2/3
via 172.16.0.18 (77312/77056), TenGigabitEthernet2/2/3
this route is legitimate and would need to issue
clear ip eigrp neighbors TenGigabitEthernet1/2/3
My question is there a way to write a script to do this within EEM?
11-11-2016 11:05 AM
Hi,
this should be possible. You can use EEM to monitor specific syslog patterns and take cli actions. In your case, you would check for e.g. 'active never' after issuing the 'show ip eigrp topology active' command. If that pattern is detected, action 'clear ip eigrp neighbors TenGigabitEthernet1/2/3' is taken.
I am working on the details of that script...unless of course you are really good at EEM and can do it faster...
11-11-2016 11:54 AM
Or, I was just thinking. Is there a way to do the following which might be easier.
Script to look in logs for
%DUAL-5-NBRCHANGE:
pause for 180 seconds
issue sh ip eigrp topo active append to EIGRP_Active.txt
send text file to smith@johndoe.com
end script
I am by no means an expert of EEM Scripting so any help would be great. Thanks GPauwen
11-13-2016 09:38 AM
Hello,
I have come up with the following script. It won't append the output of the show command to a text file, but rather send it to you in the body of the email:
Router(config)#event manager environment _email_to your-to-mail@domain.com
Router(config)#event manager environment _email_server your.mail.server
Router(config)#event manager environment _email_from your-from-mail@domain.com
event manager applet EIGRP_TOPOLOGY_ACTIVE
event syslog pattern "%DUAL-5-NBRCHANGE:"
action 1.0 cli command "enable"
action 2.0 cli command "sh ip eigrp topology active"
action 3.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "$_event_pub_time: EIGRP Neighbor Change" body "EIGRP TOPOLOGY:\n$_cli_result"
action 4.0 cli command "end"
action 5.0 cli command "exit"
Can you test this and see if it works ? You also need obviously to enable logging first...
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide