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

IOS XR 4.3.4 - modify TCL e-mail template

Juan Barquero
Level 1
Level 1

I was testing out an EEM configuration, and cannot find published documentation on one particular step: how to modify TCL templates for e-mails.

In XRv devices I am able to successfully modify the templates by going into the linux filesystem (/pkg/lib/tcl directory) and using vim. On hardware boxes, such as a lab 9K we have running our production 4.3.4, I cannot do the same (I get corrupt file errors) after modifying the template.

These are the templates I speak of:

-rw-r--r-T  1 0         0               185 Apr 08 09:14 email_template_cfg.tm
-rw-r--r-T  1 0         0               147 Apr 08 09:14 email_template_chs.tm
-rw-r--r-T  1 0         0               154 Apr 08 09:14 email_template_cmd.tm
-rw-r--r-T  1 0         0                 8 Apr 02 00:33 email_template_sl.tm
-rw-r--r-T  1 0         0               325 Apr 08 09:14 email_template_sm.tm
-rw-r--r-T  1 0         0               135 Apr 08 09:14 email_template_wd.tm

One of the e-mail templates (email_template_cfg.tm) I am trying to modify:

# more email_template_cfg.tm
Mailservername: $_email_server
From: $_email_from
To: $_email_to
Cc: $_email_cc
Subject: From router $routername: syslog msg

syslog msg: $msg
config commands performed:
$config_cmds

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

You don't need to modify these.  Just create one of your own with the format you want and feed that to the smtp_subst command.

View solution in original post

5 Replies 5

Joe Clarke
Cisco Employee
Cisco Employee

You don't need to modify these.  Just create one of your own with the format you want and feed that to the smtp_subst command.

Thanks. It seems the default directory it pulls from is /pkg/lib/tcl. If you don't specify a linux-style path starting with / it won't find the right file, i.e /disk0:/email_template_sl.tm works (my final configuration), but disk0:/email_template_sl.tm does not.

Thanks Joe!

Juan

Hey Joe. I'm running into a path problem on IOS now. I have a "flash:/", but this path is not working on my script; any ideas?

lab3560-1#dir
Directory of flash:/
    5  -rwx         147  Jan 14 2017 22:30:06 +00:00  email_template_sl.tcl
    9  -rwx        3715  Jan 14 2017 22:40:14 +00:00  sl_ip-sla-down.tcl
Using "/flash:/email_template_sl.tcl": 
Jan 14 22:38:56.988: %SYS-5-CONFIG_I: Configured from console by  on vty1 (EEM:sl_ip-sla-down.tcl)
Jan 14 22:38:58.196: %HA_EM-6-LOG: sl_ip-sla-down.tcl: cannot open email template file: couldn't open "/flash:/email_template_sl.tcl": No such device
Jan 14 22:38:58.196: %HA_EM-6-LOG: sl_ip-sla-down.tcl:     while executing
Jan 14 22:38:58.196: %HA_EM-6-LOG: sl_ip-sla-down.tcl: "smtp_subst [file join $tcl_library /flash:/email_template_sl.tcl]"
Using "flash:/email_template_sl.tcl":
Jan 14 22:34:16.945: %SYS-5-CONFIG_I: Configured from console by  on vty1 (EEM:sl_ip-sla-down.tcl)
Jan 14 22:34:18.137: %HA_EM-6-LOG: sl_ip-sla-down.tcl: cannot open email template file: couldn't open "tmpsys:/lib/tcl/flash:/email_template_sl.tcl": No such file or directory
Jan 14 22:34:18.137: %HA_EM-6-LOG: sl_ip-sla-down.tcl:     while executing
Jan 14 22:34:18.137: %HA_EM-6-LOG: sl_ip-sla-down.tcl: "smtp_subst [file join $tcl_library flash:/email_template_sl.tcl]"
This is a 3560
cisco WS-C3560-24TS (PowerPC405) 
Cisco IOS Software, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(46)SE, RELEASE SOFTWARE (fc2)

IOS doesn't require the leading '/'.  Just use flash:

Thanks for the help Joe.

In my previous post I actually posted two different paths: "/flash:/email_template_sl.tcl" and "flash:/email_template_sl.tcl"; please see the second where I tried without the leading flash, but similar to XR, it seems like there is a default path for TCL libraries, and that file isn't found either.

Using "flash:/email_template_sl.tcl":
Jan 14 22:34:16.945: %SYS-5-CONFIG_I: Configured from console by  on vty1 (EEM:sl_ip-sla-down.tcl)
Jan 14 22:34:18.137: %HA_EM-6-LOG: sl_ip-sla-down.tcl: cannot open email template file: couldn't open "tmpsys:/lib/tcl/flash:/email_template_sl.tcl": No such file or directory
Jan 14 22:34:18.137: %HA_EM-6-LOG: sl_ip-sla-down.tcl:     while executing
Jan 14 22:34:18.137: %HA_EM-6-LOG: sl_ip-sla-down.tcl: "smtp_subst [file join $tcl_library flash:/email_template_sl.tcl]"

Thanks for reviewing.