07-30-2020 02:34 PM
Dear,
I would like to know if it is possible to create a weekly backup of configuration with Cisco Router.
I tried with this configuration but the result is "abort":
event manager applet "name_of_event"
event timer watchdog time 604800 (about 7 days)
action 1.0 cli command "enable"
action 2.0 cli command "copy running-config ftp:"
action 3.0 cli command "server_ip_address"
action 4.0 cli command "folder/name_of_bck_configuration_file"
action 5.0 cli command "exit"
Result of command "show event manager statistics policy":
No. Class Triggered Suppressed Run Time Run Time Name
-------------------------------------------------------------------------------
1 applet 1 0 20.042 20.042 "name_of_event"
event {} timer watchdog (Time Remaining: 514224.208)
Result of command "show event manager history events detailed":
No. Job Id Proc Status Time of Event Event Type Name
1 1 Actv abort Tue Jul28 16:39:16 2020 timer watchdog applet: "name_of_event"
timer_time 3804939556.681 timer_remain 604800.000
Result of command "show event manager version":
Embedded Event Manager Version 4.00
How can i solve it?
Regards
07-30-2020 05:00 PM - edited 07-30-2020 08:07 PM
Hello TNMVA,
For troubleshooting / testing EEM scripts, I recommend a couple things:
event manager run <script_name>
debug event manager action cli
I took a look at your script and I believe I may know what is failing, but I don't have EEM debugs from your script to confirm. When you copy a file via FTP, you need to include the username and password in the CLI command (unless it's specified in global config via "ip ftp username / password"). The CLI parser may have been waiting for an input and script timed out after 20 seconds. I added a pattern keyword to your script, which essentially tells the script to look for a string in response to the command that was just entered (reference). If the string is a match, then proceed to next script line and enter the command in response to the pattern. The pattern keyword would be used for things like copy command or reload command where additional questions are asked prior to executing the command.
Please see below script and let me know if it works. If it does not work, please let me know the results of debugging.
event manager applet "name_of_event" event timer watchdog time 604800 action 1.0 cli command "enable" action 2.0 cli command "copy running-config ftp://<username>:<password>@<server_IP>" pattern "Address or name of remote host" action 3.0 cli command "<server_IP>" pattern "Destination filename" action 4.0 cli command "<file_path>" action 5.0 cli command "exit"
08-03-2020 06:56 AM
Hi,
thank you for the support.
I applied your suggestions:
event manager applet "script_name"
event timer watchdog time 604800
action 1.0 cli command "enable"
action 2.0 cli command "copy running-config ftp://name:password@Server_IP" pattern "IP_address"
action 3.0 cli command "IP_address" pattern "path_name/file_name"
action 4.0 cli command "path_name/file_name"
action 5.0 cli command "exit"
action 6.0 syslog priority informational msg "Configuration successfully written to FTP server"
and it worked properly.
Regards.
07-31-2020 02:41 PM
Hello,
an alternative would be the script below, which also gives your backed up file an epoch style timestamp:
event manager applet BACKUP_CONFIG
description Backup-Running-Config-To-TFTP
event timer watchdog time 604800
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 "192.168.1.2" pattern "filename"
action 1.3 cli command "$_info_routername-config_$_event_pub_sec"
action 2.0 syslog priority informational msg "Configuration successfully written to TFTP server"!
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