×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

need EEM to wait 30 seconds before triggering an email

Answered Question
May 15th, 2014
User Badges:

All I have a simple EEM script (no TCL) that matches syslog messages for a BGP adjacency changes and sends an email.  The issue I have it that it triggers so quick that convergence may not be done which causes the messages to fail.  Is there a way to add a simple XX second or msec timer between the time that it sees the syslog entry and sending of the email message.  This seems like too simple of a script to need a TCP scripted timestamp counter loop.  There has to be an easier way....

 

event manager environment _email_to [email protected]
event manager environment _email_server 10.60.204.20
event manager environment _email_from [email protected]
event manager applet BGP-Down-Alert
 event syslog pattern "%BGP-5-ADJCHANGE:.*Down*"
 action 1.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "BGP DOWN $_event_pub_time:" body "$_syslog_msg" source-address 10.65.0.1
 action 1.5 syslog priority notifications msg "BGP Message DOWN - Mail Sent"
event manager applet BGP-Restoration-Alert
 event syslog pattern "%BGP-5-ADJCHANGE:.*Up*"
 action 1.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "BGP UP $_event_pub_time:" body "$_syslog_msg" source-address 10.65.0.1
 action 1.5 syslog priority notifications msg "BGP Message UP - Mail Sent"

 

Thanks all.  I am sure this is easy and someone will be able to find where this has been discussed.  I haven't, so figured I would post.

Correct Answer by Vlad Vlaicu about 3 years 3 months ago

Hi.

 

You can set up the first action to be:

action x wait 30

Also bear in mind that you EEM applets have a default lifetime of 20 seconds, so you need to add to the "event syslog" line also the keywords "maxrun 60" which will allow the EEM applet to run up to 60 seconds.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Correct Answer
Vlad Vlaicu Thu, 05/15/2014 - 12:20
User Badges:
  • Cisco Employee,

Hi.

 

You can set up the first action to be:

action x wait 30

Also bear in mind that you EEM applets have a default lifetime of 20 seconds, so you need to add to the "event syslog" line also the keywords "maxrun 60" which will allow the EEM applet to run up to 60 seconds.

casanavep Fri, 05/16/2014 - 13:31
User Badges:

vvlaicu,

Thanks for the quick response.  Turned out the issue was the poor use of '*' vs '.*' when there was move than one variable character between '%BGP-5-ADJCHANGE:' and the word 'up' or 'down'.... Found out that my head had been placed into an improper bodily orifice.  Pulled it out and now I am good :) ; but, I really wanted to figure out the timer option.  Thanks you very much for taking the time to answer.

 

PCasa

Actions

This Discussion