cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3021
Views
5
Helpful
11
Replies

Bug in IOS-XE when using Kron?

oslopez
Level 1
Level 1

Hi,

I'm having a hard time using kron to save the router configuration to a remote tftp server. I'm using Cisco ASR1001-X  running Cisco IOS XE Software, Version 16.08.01.

The issue is as follows:

In order to forward the router configuration to a tftp server on a daily basis I came up with the following kron commands:

kron policy-list conf_bkp
 cli show running-config | redirect tftp://172.2.10.12/Configs/Router_Cfg.bkp
!
kron occurrence conf_bkp_Schedule at 22:25 recurring
 policy-list conf_bkp
!

 I made sure to save the configuration and after issuing the show run command, the kron commands appear in the router configuration.

Now, when I check the tftp server after the scheduled time (22:25), the router configuration file is nowhere to be seen.

If I type the show run command in the router, the kron policy-list command is gone. All that is left is the kron ocurrence command, but without a policy-list it won't work.

Looks to me like somehow when it's the time to save the config, the router loses the kron policy-list or something.  

The fact that the line kron policy-list conf_bkp is no longer in the configuration tells me that something is going on with the IOS. Maybe a bug? or maybe I'm missing something? Is there a better way to save configurations to a tftp or a ftp server?

Any help would be appreciated.

 

Thank you.

 

2 Accepted Solutions

Accepted Solutions

Hello,

 

that should work, and obviously, only one file will exist (since you are overwriting the existing file each time).

View solution in original post

Hello,

 

the default runtime of an EEM applet is 20 seconds. You need to add the 'maxrun' keyword, not sure where with the Kron. Try:

 

event timer cron cron_entry “0 9 * * 1" maxrun 60

View solution in original post

11 Replies 11

Hello,

 

KRON is XE has numerous bugs. You could try the EEM script below as an alternative. The script would save the running config to a TFTP server each Monday at 9 AM:

 

event manager applet BACKUP_CONFIG
description Backup-Running-Config-To-TFTP
event timer cron cron_entry “0 9 * * 1"
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"!

 

Thanks Georg. I'll customizing your script for my personal requirements but I can't fully understand what action 1.3 does. Could you please clarify?

 

Thanks.

Hello,

 

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

 

This just adds the routername to the file name, followed by a time stamp...

Perfect. In my case I need to run a daily backup and save the config in the tftp server overwriting the config saved the day before, so I need a fixed file name in the script. I'm using the following lines for that purpose (the IP address of the tftp server is 10.2.18.121, the file must be saved in the tftp sub-directory /Config_Backups and the file name is Main_RTR.BKP) :

action 1.0 cli command "enable"
action 1.1 cli command "copy run tftp" pattern "Address"
action 1.2 cli command "10.2.18.121" pattern "/Config_Backups/Main_RTR_.BKP"

Does it look good?

 

Thanks.

 

 

 

 

Hello,

 

that should work, and obviously, only one file will exist (since you are overwriting the existing file each time).

Thanks. All working good now.

Well, everything worked fine in my lab. But when implemented in the production network I had mixed results. If the TFTP server is in the US, all works fine, that's my primary server. I use another script to save the config in a secondary server, that one is physically located in Europe. So when trying to save to the secondary server, the configuration is only partially saved, I'd say 60% of it. Looking at the "show event manager history events command", I get this:

No.  Job Id Proc Status   Time of Event            Event Type        Name
9    9      Actv abort    Tue Sep21 16:17:00 2021  timer cron        applet: Conf_Bkp

It looks to me that the script is timing out when saving the config to the server in Europe.

What would be the command to increase the runtime of the applet beyond the 20 seconds limit?

Thanks.

Hello,

 

the default runtime of an EEM applet is 20 seconds. You need to add the 'maxrun' keyword, not sure where with the Kron. Try:

 

event timer cron cron_entry “0 9 * * 1" maxrun 60

The command worked fine. Now I can save on both primary and secondary servers.

Thanks a lot Georg!

marce1000
VIP
VIP

 

  - FYIhttps://bst.cloudapps.cisco.com/bugsearch/bug/CSCvn99696

 M.



-- ' 'Good body every evening' ' this sentence was once spotted on a logo at the entrance of a Weight Watchers Club !

Thanks! As advised, I'm using an EEM script instead

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:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco