cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1300
Views
0
Helpful
2
Replies

Can event manager applets be used to apply configuration changes?

terryk
Level 1
Level 1

On a Cisco 3945 running 15.7(3)M4 with ipbasek9/securityk9/uck9/hseck9/cme-srst licenses installed and active, I have an event manager configuration that pings a server in San Jose. If that server is unavailable, the goal is to fail over to a server in Los Angeles by changing a few lines in the running config. I have files in flash called "failover-losangeles" and "failover-sanjose" (for switching back) which work properly when I manually do a "copy flash:failover-losangeles running-config", but seem to have no effect on the configuration when invoked by event manager, using the following (slightly-sanitized) applet:

 

event manager applet email_server_unavailable
 event track 10 state down
 action 1.1 syslog msg "*** Ping sanjose failure - failing over to losangeles! ***"
 action 1.2 cli command "enable"
 action 1.3 cli command "del /force flash:server_unavailable"
 action 1.4 cli command "show clock | append server_unavailable"
 action 1.5 cli command "show interface Gi0/0 | append server_unavailable"
 action 1.6 cli command "copy flash:failover-losangeles running-config | append server_unavailable"
 action 1.7 cli command "more flash:server_unavailable"
 action 1.8 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Ping sanjose failure - failing over to losangeles!" body "$_cli_result"
 action 2.0 syslog msg "*** Ping sanjose failure email notification sent! ***"

 

All of the other applet actions are working and nothing odd is recorded in the router logs.

 

Is it possible to change the router's running configuration from an event manager applet? Any examples (or comments about what I am doing wrong) would be greatly appreciated. 

1 Accepted Solution

Accepted Solutions

It turns out I had a number of problems. First, "copy filename running-config" doesn't accept the | pipe operator. Second, the copy command produces query output like "Destination filename [running-config]?" which causes the event manager script to hang and eventually time out after 20 seconds (this may be configurable, I didn't investigate as it wasn't relevant).

 

What I ended up doing was embedding "configure terminal" and all of the various configuration lines as actions in the event manager applet. It is import to finish with an "end" or the router will still be in configuration mode when the applet tries to continue.

View solution in original post

2 Replies 2

Larry Sullivan
Level 3
Level 3

I would think you would be able to do this.  debug EEM and run this again and see what the debugs say.

It turns out I had a number of problems. First, "copy filename running-config" doesn't accept the | pipe operator. Second, the copy command produces query output like "Destination filename [running-config]?" which causes the event manager script to hang and eventually time out after 20 seconds (this may be configurable, I didn't investigate as it wasn't relevant).

 

What I ended up doing was embedding "configure terminal" and all of the various configuration lines as actions in the event manager applet. It is import to finish with an "end" or the router will still be in configuration mode when the applet tries to continue.

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: