cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1587
Views
0
Helpful
3
Replies

EEM Long mail command

Luke Robertson
Level 1
Level 1

Hi,

I'm trying to write a very basic EEM script, which sends an email when there is a route change:

event manager applet RoutingChanges

action 1.0 syslog msg "$_routing_type $_routing_protocol route $_routing_network/$_routing_mask with gateway $_routing_lastgateway on interface $_routing_lastinterface"


action 2.0 mail server "10.224.22.18" to "recipient" from "sender" subject "Catalyst Routing changes" body "$_routing_type $_routing_protocol route $_routing_network/$_routing_mask with gateway $_routing_lastgateway on interface $_routing_lastinterface" source-address 10.224.100.250

The problem is that 'action 2.0' is too long to type in. Is there any way I can break this into multiple lines?

Thanks

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

Sure.  Just create a variable:

set body "$_routing_type $_routing_protocol route $_routing_network/$_routing_mask with gateway $_routing_lastgateway on interface $_routing_lastinterface"

action 2.0 mail ... body "$body"

View solution in original post

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

Sure.  Just create a variable:

set body "$_routing_type $_routing_protocol route $_routing_network/$_routing_mask with gateway $_routing_lastgateway on interface $_routing_lastinterface"

action 2.0 mail ... body "$body"

Thanks.

There doesn't appear to be a 'set' command. Instead, I tried this:

event manager environment body "$_routing_type $_routing_protocol route $_routing_network/$_routing_mask with gateway $_routing_lastgateway on interface $_routing_lastinterface"

The problem with this is that it literally emails me "$_routing_type $_routing_protocol route $_routing_network/$_routing_mask with gateway $_routing_lastgateway on interface $_routing_lastinterface"

Just figured out that it's now 'action set ...'

This is now working, thanks

Review Cisco Networking for a $25 gift card