cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5328
Views
70
Helpful
29
Replies

EEM - Automated Backup Before Configuration Change

TW80CJ5
Level 3
Level 3

I am trying to build an EEM applet that will automatically backup the configuration to the flash before changes are made. I do have AAA configured so I am using  - event manager session cli username "eem.user" where the user is a local user with admin privileges.

 

Here is what I am trying so far and it isnt working:

 

event manager applet CONFIG_CHANGE
description Backup of Config Before Changes Made
event syslog pattern "%SYS-5-CONFIG_I: Configured from"
action 1.0 cli command "config t"
action 1.1 cli command "copy run flash:/" pattern "Address"
action 1.2 cli command "" pattern "Destination"
action 1.3 cli command ""

 

Thoughts or suggestions?

 

29 Replies 29

I do a "dir flash:/" and it returns "bootflash:/"

what is this device Model you doing this EEM, based on that you need to change the path.

BB

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

How to Ask The Cisco Community for Help

It is a 4431 with Fuji 16.09.07

What happens when you do the copy manually using the same syntax in the EEM policy?

I will pick this up in the morning and let you know. Thank you very much for the help. Have a good evening.

Mr. Danield Frey....not sure if you saw my email response, but i manually typed the commands in and still had no luck.

looks like we miss the track, where do we stand in terms of the problem still issue?

 

can you post EEM Script?

 

sh event manager policy registered
debug event manager action cli

 

 

BB

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

How to Ask The Cisco Community for Help

BB, thanks for checking in. I will let you know once I get in the office tomorrow morning.


Thanks again!

BB,

 

Here is the debug from Friday.

*Jun 14 2021 12:42:52.200: %HA_EM-6-LOG: CONFIG_CHANGE : DEBUG(cli_lib) : : IN  : FIELDOFF101-RTR-01>copy run bootflash:FIELDOFF101-RTR-011623674572
*Jun 14 2021 12:42:52.311: %HA_EM-6-LOG: CONFIG_CHANGE : DEBUG(cli_lib) : : OUT : copy run bootflash:FIELDOFF101-RTR-011623674572
*Jun 14 2021 12:42:52.311: %HA_EM-6-LOG: CONFIG_CHANGE : DEBUG(cli_lib) : : OUT :   ^
*Jun 14 2021 12:42:52.311: %HA_EM-6-LOG: CONFIG_CHANGE : DEBUG(cli_lib) : : OUT : % Invalid input detected at '^' marker.
*Jun

I believe you do not have enable here.

 

action 1.0 cli command "enable"

 

BB

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

How to Ask The Cisco Community for Help

BB,

 

I tried that and I still cant get it to work. See the attached for my latest config example and the latest debug. I changed "bootflash" to "flash in the applet with no luck. Thanks for all of the help!

Here is a second eem config and debug file that is not working.

 

I really appreciate the help!!!!!!!!

May be when i download logs it more of garbage, may be for me i guess.

 

just to confirm are you running EEM script manually ? why not run the EEM script start now. try to config t and edit the config so debug will be clear.

 

BB

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

How to Ask The Cisco Community for Help

BB,


Good morning. Sorry for the delay as I was out of the office. I took a working EEM config and kind of massaged it into this config and it works!!!!! Full disclosure, I am not sure if I have set the hostname and epoch correct, but this does work like a champ and provides the hostname of the device as well as date and time of the config backup. I also stopped trying to backup to flash since I couldnt get it to work so I pointed it to my scp server. Here is the example:

 

 

 

event manager applet BACKUP_BEFORE_CONFIG_CHANGE
description Backup of Config Before Changes Made
event syslog pattern "%SYS-5-CONFIG_I"
action 1.0 info type routername
action 1.1 set hostname "$_info_routername"
action 1.2 set epoch "$_event_pub_sec"
action 1.3 cli command "enable"
action 1.4 cli command "copy running-config scp://username:password@xxx.xxx.xxx.xxx/ROUTER/CONFIG_CHANGE_BACKUP/$hostname" pattern "Address"
action 1.5 cli command "" pattern "Destination"
action 1.6 cli command "" pattern "Destination"
action 1.7 cli command ""

Good and Glad working all, our suggestions helped to resolve the issue, apprciated your feedback.

 

BB

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

How to Ask The Cisco Community for Help