cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2192
Views
0
Helpful
6
Replies

Need to add wait of 120 seconds before sending email

ismailsh12
Level 1
Level 1

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"

1 Accepted Solution

Accepted Solutions

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"

View solution in original post

6 Replies 6

Joe Clarke
Cisco Employee
Cisco Employee

See this document: How To Introduce Large Delays In EEM Policies .  It should help give you exactly the behavior you want.

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.

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.

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

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"

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.