cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4786
Views
0
Helpful
16
Comments
Dan Frey
Cisco Employee
Cisco Employee

 Script calculates an MD hash of the running configuration and compares
it to the previous MD5 hash, if the hash matches the config has not
changed and no action is taken. If hash is different the script will copy the configuraton

to an FTP server.


Script will trigger based on a crontab entry of "0 0 * * *" and this equals
everyday at midnight.

 

 Requirements:
 Three EEM environmental variables must be created in the device CLI
event manager environment ftpserver <ftp ip address>
event manager environment ftpuser <username>
event manager environment ftppass <ftp password>

 

Forth environment variable is optional.   If set the script will set the OIDs in the CISCO-COPY-CONFIG-MIB to do the FTP transfer.   If this variable is not set the script will use normal CLI to perform the FTP transfer.
event manager environment community <snmp community>

Note that snmp community must have write permission if using SNMP.
  snmp-server community <snmp community> rw

 

Script can also be executed manually on the CLI exec mode:

event manager run config_backup.tcl

Comments
nonamer15
Beginner
Beginner

I tried running a show command with a double pipe from the CLI, but that didn't work. What I ended up doing was before writing the contents of $result to a file, I added the following:

regsub -all -line "Current configuration(.*)\n" $result "" result

This would remove all lines starting with Current configuration.

 

How different is this script for a Nexus device? I tried running the script, but it complains about most of the code. Mainly, it seems the namespaces are not valid and because the namespaces aren't valid, commands like cli_open and cli_exec fail. Do you know of the counterparts for these on Nexus?

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:

Recognize Your Peers
Quick Links