cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8635
Views
0
Helpful
2
Replies

need EEM to wait 30 seconds before triggering an email

casanavep
Level 3
Level 3

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 y@x.com
event manager environment _email_server 10.60.204.20
event manager environment _email_from x@x.com
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.

1 Accepted Solution

Accepted Solutions

Vlad Vlaicu
Level 1
Level 1

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.

========== NMS Team Krakow, Poland Cisco TAC

View solution in original post

2 Replies 2

Vlad Vlaicu
Level 1
Level 1

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.

========== NMS Team Krakow, Poland Cisco TAC

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