cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2613
Views
0
Helpful
8
Replies

EEM TCL Script to send mail for IPSLA Fail over

CSCO12798688
Level 1
Level 1

Hello everyone

I wrote a tcl script for sending an email when there is an ipsla fail over happend, but i'm getting some errors, kindly help me someone

Kindly have a look my configuration

ip sla 30
icmp-echo 192.168.1.4 source-ip 192.168.2.1
threshold 30
frequency 10
ip sla schedule 30 life forever start-time now

Track 30
IP SLA 30 reachability
Reachability is Up
13 changes, last change 00:28:12
Latest operation return code: OK
Latest RTT (millisecs) 8

-------------

Script

-------------
::cisco::eem::event_register_syslog occurs 1 pattern ".*TRACKING-5-STATE: 30 ip sla 30 reachability Up->Down*"

namespace import ::cisco::eem::*
namespace import ::cisco::lib::*


set mail_pre "exmail.emirates.net.ae: abcd@autoex.ae:Exms20!7\n"
append mail_pre "From: mailto@autoex.ae\n"
append mail_pre "To: 05200001@email2sms.ae\n"
append mail_pre "Subject: DataCentre-IPSLA\n\n"
append mail_pre "connection-Lost-with_1.4\n\n"
set mail_msg [uplevel #0 [list subst -nobackslashes -nocommands $mail_pre]]
if [catch {smtp_send_email $mail_msg} result] {
error $result $errorInfo
}

-----------
error log
-----------
Jul 20 08:13:31.368: %TRACKING-5-STATE: 30 ip sla 30 reachability Up->Down
%HA_EM-6-LOG: MAILIPSla.tcl: wrong 1st line format.
%HA_EM-6-LOG: MAILIPSla.tcl: usage: Mailservername: <list of server names>
%HA_EM-6-LOG: MAILIPSla.tcl: while executing
%HA_EM-6-LOG: MAILIPSla.tcl: "smtp_send_email $mail_msg"
%HA_EM-6-LOG: MAILIPSla.tcl: invoked from within
%HA_EM-6-LOG: MAILIPSla.tcl: "$slave eval $Contents"
%HA_EM-6-LOG: MAILIPSla.tcl: (procedure "eval_script" line 7)
%HA_EM-6-LOG: MAILIPSla.tcl: invoked from within
%HA_EM-6-LOG: MAILIPSla.tcl: "eval_script slave $scriptname"
%HA_EM-6-LOG: MAILIPSla.tcl: invoked from within
%HA_EM-6-LOG: MAILIPSla.tcl: "if {$security_level == 1} { #untrusted script
%HA_EM-6-LOG: MAILIPSla.tcl: interp create -safe slave
%HA_EM-6-LOG: MAILIPSla.tcl: interp share {} stdin slave
%HA_EM-6-LOG: MAILIPSla.tcl: interp share {} stdout slave
%HA_EM-6-LOG: MAILIPSla.tcl: ..."
%HA_EM-6-LOG: MAILIPSla.tcl: (file "tmpsys:/lib/tcl/base.tcl" line 50)
%HA_EM-6-LOG: MAILIPSla.tcl: Tcl policy execute failed:
%HA_EM-6-LOG: MAILIPSla.tcl: wrong 1st line format.
%HA_EM-6-LOG: MAILIPSla.tcl: usage: Mailservername: <list of server names>

1 Accepted Solution

Accepted Solutions

No, only applets can do encrypted SMTP.  But applets do not support '@' in usernames.  Your only other alternative is to setup a mail server that either doesn't require encryption or can use a simpler username.

View solution in original post

8 Replies 8

Joe Clarke
Cisco Employee
Cisco Employee

The error states that your first line is malformed, and it is.  As the error says you need to make sure your first line begins with "Mailservername:".  So, in your case:

set mail_pre "Mailservername: abcd@autoex.ae:Exms20!7@exmail.emirates.net.ae\n"

I'm guessing based on what you tried.  Note: EEM Tcl does NOT do encrypted SMTP.  Only applets support that.

hello joe,

Thank you for your response...!

I still confused as you suggested in my first line

imagine my mail server name is exmail.emirates.net.ae and username is abcd@autoex.ae  and password is Exms20!7 in this criteria the below configuration is true?

set mail_pre "Mailservername: abcd@autoex.ae:Exms20!7@exmail.emirates.net.ae\n

-------------------------

I think i cant do it applets because my username have @ , am i right joe?

Yes, this is correct.

hello joe,

i have tried the below configuration, unfortunately still i face the same error "%HA_EM-6-LOG: MAILIPSla.tcl: wrong 1st line format."

set mail_pre "Mailservername: abcd@autoex.ae:Exms20!7@exmail.emirates.net.ae\n

am i doing wrong?. any guess.?

is it possible to do encrypted smtp in any other way?, i mean other than tcl 

No, only applets can do encrypted SMTP.  But applets do not support '@' in usernames.  Your only other alternative is to setup a mail server that either doesn't require encryption or can use a simpler username.

Thank you joe.

You must not have a space between Mailservername: and the username.  You must have a space there.  It needs to be:

set mail_pre "Mailservername: abcd@autoex.ae:Exms20!7@exmail.emirates.net.ae\n"