cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2807
Views
0
Helpful
5
Replies

EEM Email when port up and down

Michael Durham
Level 4
Level 4

I am completely new to EEM and scripting.  My goal is to send an email to our support when someone shuts or no shuts a DMVPN tunnel. If there is a way to send an SMS too/instead, even better.  No 3G or 4G modem is in this router.

The interface is Tunnel200

We are using Office365 as our mail server.

Here was my failing attempt:

event manager environment _email_server support:Cisco$1@mail.pse.com
event manager environment _email_to me@pse.com
event manager environment _email_from support@pse.com
event manager applet Email_Tunnel_Status_Changed
event syslog pattern %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel200, changed state to up
action 1.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "PSE Customer tunner for $_info_routername is UP" body "$_info_routername" at "$_event_pub_time:" Changed the state of the DMVPN tunnel to PSE to UP
action 1.1 syslog msg "PSE Tunnel in UP state and E-mail was sent"
action 2 else
event syslog pattern %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel200, changed state to down
action 3.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "PSE Customer tunner for $_info_routername is DOWN" body "$_info_routername" at "$_event_pub_time:" Changed the state of the DMVPN tunnel to PSE to DOWN
action 3.1 syslog msg "PSE Tunnel in DOWN state and E-mail was sent"
action 4.0 exit

5 Replies 5

balaji.bandi
Hall of Fame
Hall of Fame

Lets do step by step

 

check is the EEM Script running before you sending email adding it, later SMS too

Are you able to see Syslog message as per the script in the syslog you see 

 

action 1.1 syslog msg "PSE Tunnel in UP state and E-mail was sent"

action 3.1 syslog msg "PSE Tunnel in DOWN state and E-mail was sent"

 

if this is working, i see you do not have email server variable to send emails  from server for your case office365, is this reachable on this device ?

 

Most of the provider offers (some i know and tested before you can send XXXXX@provider.com using your email server) - XXXX mobile bnumber.

 

 

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

No, this errors out when entered into the router:

 

event syslog pattern %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel200, changed state to up

Looks your EEM Applet not loaded correctly

 

Can you post output of below :

 

sh event manager policy registered
show run | begin event

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Hi

try with quotation marks around the pattern

event syslog pattern "%LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel200, changed state to up"

 

Daniel Freitas
Level 1
Level 1

Do you have another router on the network that have a way to send SMS?

If yes, I may have a solution for this problem.