cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1093
Views
0
Helpful
1
Replies

EEM Script to send IPSLA Alert emails (IOS XE)

jason.czaja
Level 1
Level 1

Hi folks.. I'll be upfront, I'm not overly familiar with EEM scripting but managed to get IPSLA alerts working on my 3900 series routers. That said, the EEM script I used on the 3900's won't work on my 4451's as it runs IOS XE and does not have the IPSLA detector when issuing the "sh event manager detector all" command. I did a little bit of reading and it looks like i could use the 'track' detector. Here's a script i found. Will this work?

event manager environment _email_server 192.168.1.10
event manager environment _email_from alerts@domain.local
event manager environment _email_to oncall@domain.local

event manager applet internet_down
event track 1 state down
action 1.0 syslog msg "Primary Internet Circuit Down"
action 1.1 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Circuit Down" body "Primary Internet Circuit Down."

event manager applet internet_UP
event track 1 state up
action 2.0 syslog msg "Primary Internet Circuit UP"
action 2.1 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Circuit UP" body "Primary Internet Circuit UP."

This is what i have on my 3900's.. How could i add the 'wait 8' part of the script to the one above?

event manager environment _email_server xxxxxxx

event manager environment _email_from xxxxxxx

event manager environment _email_to xxxxxx

event manager applet ISPChecker

 event ipsla operation-id 1 reaction-type timeout

 action 1.0 if $_ipsla_condition eq "Occurred"

 action 1.1  wait 8

 action 1.2  syslog msg "Primary Internet Circuit Down"

 action 1.3  mail server "$_email_server" to "$_email_to" from "$_email_from" subject “ALERT: Internet appears to be DOWN" body "Failing over in less than 1 minute"

 action 1.4 else

 action 1.5  syslog msg "Primary Circuit Up"

 action 1.6  mail server "$_email_server" to "$_email_to" from "$_email_from" subject “ALERT: Internet is back UP" body "Failing over to primary ISP"

 action 1.7 end

Thank you!!

-jay

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

Not sure why you need the wait.  Yes, these applets will work, but you need to make sure your tracked object 1 is properly configured.  You did not include that configuration here.