07-20-2017 01:58 AM
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>
Solved! Go to Solution.
07-23-2017 10:33 AM
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.
07-21-2017 10:36 AM
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.
07-21-2017 11:24 PM
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?
07-22-2017 01:13 PM
Yes, this is correct.
07-22-2017 10:34 PM
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.?
07-22-2017 10:43 PM
is it possible to do encrypted smtp in any other way?, i mean other than tcl
07-23-2017 10:33 AM
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.
07-24-2017 10:23 PM
Thank you joe.
07-23-2017 10:31 AM
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"
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