Automatic backup of routers' config using to EEM or Kron

Unanswered Question
Mar 7th, 2008

Hello All,

We are planning to automatic backup of startup-config or running-config for all routers and switches' using TFTP or FTP.

Can anybody provide me EEM configuration or any script so I can take automatic backup at regular interval?

Thanks,

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4 (2 ratings)
Loading.
cisco24x7 Fri, 03/07/2008 - 19:21

How about this: RANCID and it is FREE. You

can get the whole thing up and running

in 10 minutes on a gentoo linux box.

CCIE Security

Joe Clarke Sat, 03/08/2008 - 10:29

In addition to EEM, IOS also has a built-in config archive feature. You can archive configuration diffs to flash, or to an external server. Config archive provides the ability to look at differences between configuration changes, as well as rollback changes (even timed rollback). See http://www.cisco.com/en/US/docs/ios/12_2/configfun/configuration/guide/fcf007.html for more on the built-in IOS configuration management features.

As for an EEM policy to do automatic config archives, I did this for a Networkers session I gave a few years back. It uses the EEM timer event detector to copy the config to an FTP server at a specified interval (much like the way config archive works in IOS). It requires a few environment variables to be set first:

cc_cron_entry : Cron entry for when to run the policy (works just like UNIX cron)

cc_ftp_server : FTP server to which configs will be copied

cc_ftp_path : Path on aformentioned FTP server

cc_ftp_user : (optional) FTP username (defaults to anonymous)

cc_ftp_pass : (optional) FTP password (defaults to pass)

See http://www.cisco.com/en/US/docs/ios/12_4t/netmgmt/configuration/guide/t_eemo.html for more on configuring and using EEM.

20vek Tue, 05/13/2008 - 19:06

Just wondering if can replace environment variables with predefined FTP configuration. For example:

router(config)#ip host FTPServer a.b.c.d

router(config)#ip ftp username USERNAME

router(config)#ip ftp password PASSWORD

in this case ftp client password will be encrypted

so the command line in the script would look like "copy runn ftp://FTPServer/router1/${dest_fname}"

would it work?

Joe Clarke Tue, 05/13/2008 - 20:59

Yes, this should work since the copy command goes through the same parser code as when it is run manually from the command line.

atif-siddiqui Wed, 05/28/2008 - 09:40

I have tried Ivan's EEM script, but unable to action the cli command "archive config".

event manager applet ArchiveModifiedConfig

event counter name "ConfigCounter" entry-val 1 entry-op eq exit-val 1 exit-op gt

action 1.0 cli command "archive config"

action 2.0 syslog msg "Modified configuration archived"

action 1.0 does not invoke, but i do see a syslog message which is 2.0

just wondering if you have tried it.

Joe Clarke Wed, 05/28/2008 - 09:42

The first command needs to be enable:

event manager applet ArchiveModifiedConfig

event counter name "ConfigCounter" entry-val 1 entry-op eq exit-val 1 exit-op gt

action 1.0 cli command "enable"

action 2.0 cli command "archive config"

action 3.0 syslog msg "Modified configuration archived"

atif-siddiqui Wed, 05/28/2008 - 10:30

thanks. it worked.

can we do or capture some diffs in an automated way, i know we can do that manually.

Joe Clarke Wed, 05/28/2008 - 11:27

You can use the show archive config differences command to diff any two files right on the device. You can then pipe this output to a file.

Actions

This Discussion