05-15-2014 09:54 AM
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.
Solved! Go to Solution.
05-15-2014 12:20 PM
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.
05-15-2014 12:20 PM
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.
05-16-2014 01:31 PM
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
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