01-06-2014 12:25 PM
Hi,
I have setup an IP SLA on my cisco 3850 switch internally. Everything is working great! What i need to know is how can i setup an Embedded Event Manager (EEM) email alert on my 3850 so when the IP SLA does occur i want an email triggered informing me. Same goes for when IP SLA returns back to primary route.
Your help is appreciated immensely.
Saif
Solved! Go to Solution.
01-07-2014 08:42 AM
You can use the IP SLA detector. You have to configure your IP SLA collector to have a reaction-config. Assuming it's a timeout you want, you would configure the reaction-config to be for a timeout, then your EEM event will be:
event ipsla reaction-type timeout operation-id X
Where X is the IP SLA collector ID. Then, within your applet, you'll need an if statement:
action 1.0 if $_ipsla_condition eq Occurred
action 1.1 syslog msg "Primary Internet Circuit Down"
action 1.2 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Circuit Down" body "Primary Internet Circuit Down."
action 1.3 else
action 1.4 syslog msg "Primary Internet Circuit UP"
action 1.5 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Circuit UP" body "Primary Internet Circuit UP."
action 1.6 end
This means you only need one applet.
01-21-2014 10:06 AM
You're missing:
event manager applet ISPCheck
event ipsla reaction-type timeout operation-id 1
01-06-2014 12:34 PM
I think there is a dedicated section for EEM scripting, you will probably get better and more beneficial answers by moving your post from the right hand side of your post in the Actions section.
Please rate useful posts & remember to mark any solved questions as answered. Thank you.
01-06-2014 12:36 PM
Thank you. i have moved this discussion to EEM scripting.
01-06-2014 02:12 PM
OK i did some research and found the following script someone used.
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."
Will this work on a 3850? Because the 3850 uses IOS-XE and a lot of the commands are different. I am afraid to try anything on my live network.
thanks,
Saif
01-07-2014 08:23 AM
I believe the 3850 supports the track ED. You can tell by running the command:
show event manager detector all
And look for "track" in the output. If it's there, then this will work. Note, you'd also need to configure your IP SLA collector and tracked object (I don't see that here).
I would also recommend you do find some way to test this. Even if it works in theory, everyone's network is unique in some way, and it would be good to confirm it's going to work without issue in your environment.
01-07-2014 08:37 AM
I dont have track, but i do have IPSLA as one of the detectors. Not sure how i can use that. My only problem is that i cant test this.
01-07-2014 08:42 AM
You can use the IP SLA detector. You have to configure your IP SLA collector to have a reaction-config. Assuming it's a timeout you want, you would configure the reaction-config to be for a timeout, then your EEM event will be:
event ipsla reaction-type timeout operation-id X
Where X is the IP SLA collector ID. Then, within your applet, you'll need an if statement:
action 1.0 if $_ipsla_condition eq Occurred
action 1.1 syslog msg "Primary Internet Circuit Down"
action 1.2 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Circuit Down" body "Primary Internet Circuit Down."
action 1.3 else
action 1.4 syslog msg "Primary Internet Circuit UP"
action 1.5 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Circuit UP" body "Primary Internet Circuit UP."
action 1.6 end
This means you only need one applet.
01-07-2014 03:00 PM
Is the IP SLA collector ID the same as IP SLA ID?
exmaple:
ip sla 1
echo-icmp..............
thanks,
01-07-2014 07:59 PM
Yep, that's the one. You'll also need a reaction-configuration for this same ID to get it to trigger when a condition occurs.
01-08-2014 07:51 AM
Joseph i'm sorry, but i am new to cisco and even more EEM. Given the script above what should my script look like?
I dont know what reaction-configuration is.
thanks
01-08-2014 07:58 AM
Something like this:
ip sla reaction-configuration 1 react timeout threshold-type immediate
ip sla enable reaction-alerts
01-08-2014 08:49 AM
Sorry to bother, but will this be my full script then:
event manager environment _email_server 192.168.x.x
event manager environment _email_from alerts@domain.local
event manager environment _email_to oncall@domain.local
event ipsla reaction-type timeout operation-id 1
ip sla reaction-configuration 1 react timeout threshold-type immediate
ip sla enable reaction-alerts
action 1.0 if $_ipsla_condition eq Occurred
action 1.1 syslog msg "Primary Internet Circuit Down"
action 1.2 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Circuit Down" body "Primary Internet Circuit Down."
action 1.3 else
action 1.4 syslog msg "Primary Internet Circuit UP"
action 1.5 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Circuit UP" body "Primary Internet Circuit UP."
action 1.6 end
Thanks
01-09-2014 07:00 AM
The IP SLA commands are not part of the EEM policy. They are part of your IP SLA configuration. You'll need to enter them before configuring the applet. The rest of the EEM commands look okay.
01-21-2014 09:54 AM
Ok sorry for being late on this. I was awaiting my spare 3850 to arrive.
I have setup IP SLA on my spare switch and setup the script as we discused, but when i configured it, i get this error:
%HA_EM-4-FMPD_NO_EVENT: No event configured for applet ISPCheck
This is what i have inputted so far:
ip sla 1
icmp-echo 8.8.8.8 source-ip 192.168.10.1
frequency 5
ip sla schedule 1 life forever start-time now
ip sla reaction-configuration 1 react timeout threshold-type immediate
ip sla enable reaction-alerts
track 1 ip sla 1 reachability
delay down 90 up 90
event manager environment _email_server
event manager environment _email_from IPSLA@domain.local
event manager environment _email_to IPSLA@domain.local
event manager applet ISPCheck
action 1.0 if $_ipsla_condition eq "Occurred"
action 1.1 syslog msg "Primary Internet Circuit Down"
action 1.2 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Circuit Down" body "Primary Internet Circuit Down."
action 1.3 else
action 1.4 syslog msg "Primary Internet Circuit UP"
action 1.5 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Circuit UP" body "Primary Internet Circuit UP."
action 1.6 end
01-21-2014 10:06 AM
You're missing:
event manager applet ISPCheck
event ipsla reaction-type timeout operation-id 1
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