01-26-2017 07:47 AM
Hi, I would like to add a wait time of 120 seconds before sending email using EEM script. This would give enough time for the failover convergence and ensure email is sent using the backup link. Below is what i have configured so far.
Also i would like to add the output of show interfaces description along with show ip bgp summary in my email output.
event manager environment _email_to name@company.com
event manager environment _email_server relayus.company.com
event manager environment _email_from EEM.script@company.com
event manager applet checkbgp
event syslog pattern "BGP-5-ADJCHANGE.*Down"
action 100 cli command "enable"
action 110 cli command "sh ip bgp summ"
action 120 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "$_event_pub_time: xxx1rtr02 BGP is down" body "show ip bgp summary:\n$_cli_result"
action 130 syslog priority 5 msg "EEM script - BGP Down - email sent"
Solved! Go to Solution.
01-30-2017 03:45 PM
You can do something like:
cli command "show ip bgp summ"
set bgps $_cli_result
cli command "show int descr"
mail ... body "$bgps $_cli_result"
01-26-2017 08:50 AM
See this document: How To Introduce Large Delays In EEM Policies . It should help give you exactly the behavior you want.
01-26-2017 12:33 PM
Hi Joe,
I did look at this document and the question i have is, do we need to configure nested policy for the delay? Cant we just use the wait command and achieve the same? I tried using it in my gns lab but was not successful and thought i will reach out to someone who has used that command.
01-26-2017 01:06 PM
The wait command will work provided you increase the maxrun time to 140. But this is not recommended. It will cause the applet to block locking up one of your available applet threads for that whole time. The async nesting approach is better as it keeps your thread queue mostly clean.
01-30-2017 03:11 PM
Hi Joe,
Thank you for the reply and clarification. Please can you tell me how I can add the output of show interfaces description along with show ip bgp summary in my email output. In my config action 110 cli command "sh ip bgp summ" and i also want something like action 120 cli command "sh int desc" and then both of these cli outputs in my email. When i tried to configure it, i found out that it only sends the last cli command in the list, in this case i only get "show int desc" and i dont get the "sh ip bgp summ" in the body.
Regards,
Ismail
01-30-2017 03:45 PM
You can do something like:
cli command "show ip bgp summ"
set bgps $_cli_result
cli command "show int descr"
mail ... body "$bgps $_cli_result"
02-01-2017 06:19 AM
Hi Joe,
Thank you very much for your help. Below is the command i used in my EEM applet
action 140 set bgps "$_cli_result"
and then used it in the body as you mentioned above.
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