06-09-2021 09:41 AM
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?
Solved! Go to Solution.
06-10-2021 02:03 PM
06-10-2021 02:46 PM
what is this device Model you doing this EEM, based on that you need to change the path.
06-10-2021 02:50 PM
06-10-2021 02:52 PM
What happens when you do the copy manually using the same syntax in the EEM policy?
06-10-2021 03:19 PM
06-13-2021 07:57 AM
Mr. Danield Frey....not sure if you saw my email response, but i manually typed the commands in and still had no luck.
06-13-2021 10:40 AM
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
06-13-2021 11:05 AM
BB, thanks for checking in. I will let you know once I get in the office tomorrow morning.
Thanks again!
06-14-2021 05:59 AM
06-15-2021 01:50 AM
*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"
06-15-2021 05:28 AM
06-15-2021 05:52 AM
06-16-2021 02:38 AM
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.
06-21-2021 07:08 AM
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 ""
06-21-2021 08:22 AM
Good and Glad working all, our suggestions helped to resolve the issue, apprciated your feedback.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide