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

EEM Applet that will automatically backup the configuration to a TFTP server after changes are made.

Robert Molina
Level 1
Level 1

I am attempting to use EEM to build an applet that will automatically backup the configuration to a TFTP server after changes are made per DISA STIGS. I have tried different variations and still come up with no backup.

First I tested the command  #copy run tftp://10.0.0.10 and it copies the configuration without any issue. I can write it this way to get a text file  #copy run tftp://10.0.0.10/<switchname>.txt

 

I am getting quite frustrated trying to make an applet to work. Here is what I have tried

 

event manager applet Backup-Config

event syslog pattern "%SYSLOG-5-CONFIG_I"

action 1 info type routername (only option that matches)

action 1.1 cli command "enable"

action 1.2 cli command "copy run tftp" pattern "remote host"

action 1.3 cli command "10.0.0.10" pattern "filename"

action 1.4 cli command "$_info_routername-config"

 

I tried different variations and nothing happens.

Can anyone help me? This is the first time I am working with EEM and it is definitely like learning a new language.

Thank you for any assistance.

Robert

5 Replies 5

balaji.bandi
Hall of Fame
Hall of Fame

i tested some time back this works.

 

event manager applet Backup-Running-Config
description Backup-Running-Config
event syslog pattern "%SYS-5-CONFIG_I: Configured from"
action 0.1 info type routername
action 1.0 cli command "enable"
action 1.1 cli command "copy run tftp" pattern "Address"
action 1.2 cli command "10.10.10.10" pattern "filename"
action 1.3 cli command "$_info_routername-config_$_event_pub_sec"
action 2.0 syslog priority informational msg "Configuration change detected. Write to TFTP succesfully executed"!

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

balaji.bandi



I modified my applet with changes and made it look exactly like what you
have. After I had removed the previous version and then re-input the latest
version. I saved the running configuration and made a change by changing one
of the interfaces. There was no running config copied to the tftp server. I
am logged in and I have permissions to make changes, etc. but I still don't
get any output on the tftp server. What else could be wrong?



Thanks,

Robert


Are you able to copy the config to TFTP to confirm is this working?

 

Do you get success log in the Logs ?

 

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Can command:



Copy run tftp:10.0.0.10/switchname.cfg

Returns

Address or name of remote host [10.0.0.10]? I hit enter key to accept

Destination or filename [switchname.cfg]? I hit enter key to accept



!!

16715 bytes copied in 10.160 secs



I checked the logs and there is nothing showing as it being successful. I
checked the tftp server and the latest file is there. Only success message
is Login success.


I tested something like this recently. For me, my testing suggests that this line is incorrect:

action 1.3 cli command "$_info_routername-config_$_event_pub_sec"

when I changed the variable to $_info_routername-confg it worked.