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

EEM SMTP issue on IOS-XR

Asad Ul Islam
Level 1
Level 1

friends,

i am trying simple eem script to send email alert on log message (IOS XR 4.3.1)..  but i am getting following error;

RP/0/RSP0/CPU0:Jan 24 21:04:17.776 : syslog_dev[92]: noscan: error connecting to mail server:

RP/0/RSP0/CPU0:Jan 24 21:04:17.776 : syslog_dev[92]: noscan: cannot connect to all the candidate mail servers

RP/0/RSP0/CPU0:Jan 24 21:04:17.776 : syslog_dev[92]: noscan:     while executing

RP/0/RSP0/CPU0:Jan 24 21:04:17.776 : syslog_dev[92]: noscan: "smtp_send_email $mail_msg"

RP/0/RSP0/CPU0:Jan 24 21:04:17.776 : syslog_dev[92]: noscan:     invoked from within

RP/0/RSP0/CPU0:Jan 24 21:04:17.776 : syslog_dev[92]: noscan: "if [catch {smtp_send_email $mail_msg} result] {

RP/0/RSP0/CPU0:Jan 24 21:04:17.776 : syslog_dev[92]: noscan:     error $result $errorInfo

RP/0/RSP0/CPU0:Jan 24 21:04:17.776 : syslog_dev[92]: noscan: }

RP/0/RSP0/CPU0:Jan 24 21:04:17.776 : syslog_dev[92]: noscan: "

RP/0/RSP0/CPU0:Jan 24 21:04:17.776 : syslog_dev[92]: noscan:     (file "/dev/rdsfs/etc/eem_rdsfs/config_done.tcl" line 26)

==== EEM Script ====

::cisco::eem::event_register_syslog pattern {%MGBL-SYS-5-CONFIG_I}

namespace import ::cisco::eem::*

namespace import ::cisco::lib::*

array set arr_einfo [event_reqinfo]

set mail_pre "Mailservername: 1.1.1.254\n"

append mail_pre "From: nms@isp.com\n"

append mail_pre "To: asad@isp.com\n"

append mail_pre "Cc: \n"

append mail_pre "Sourceintf: Loopback0\n"

append mail_pre "Subject: Some Configuration Done\n\n"

append mail_pre "Some weird Configuration is Done on ASR 9010. Take Immediate Action\n\n"

set mail_msg [uplevel #0 [list subst -nobackslashes -nocommands $mail_pre]]

if [catch {smtp_send_email $mail_msg} result] {

    error $result $errorInfo

}

========================

I can connect to SMTP server from Router CLI using source-interface

RP/0/RSP0/CPU0:ASR-9010#telnet 1.1.1.254 25 source-interface loopback 0

Trying 1.1.1.254...

Use specified source interface(Loopback0).

Use 1.1.1.254 as local address.

Connected to 1.1.1.254.

Escape character is '^^'.

220 smtp.isp.com ESMTP Postfix

221 2.0.0 Bye

RP/0/RSP0/CPU0:ASR-9010#

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

I do not think your version of XR supports the source interface option.  You can check the smtp_lib.tcl on your router to confirm.  On IOS, this is in tmpsys:/lib/tcl.  I can't recall off the top of my head where this resides on XR, but if you hunt around the various file systems you will find it.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: