cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2450
Views
0
Helpful
2
Replies

Configuration backups using tcl -> ftp, typeahead problems

Hi all,

I am setting up automatic running-config backup schedule on a range of devices (2800 series, 800 series, Catalyst 4948). I'm doing the configuration backup via ftp. Copying files to ftp: filesystem is always interactive (IOS prompts for hostname and filename). As kron can't pass any input to commands it executes, the theoretical way round is to use tcl and typeahead. The problem is that typeahead simply doesn't seem to work for me. Software versions:

870: 12.4(4)T6, RELEASE SOFTWARE (fc2)

2800:Version 12.4(3h), RELEASE SOFTWARE (fc2)

2800:Version 12.4(3d), RELEASE SOFTWARE (fc3)

4948:Version 12.2(25)SG, RELEASE SOFTWARE (fc2)

So okay, on the Catalysts I can forget about tcl if I don't upgrade the software, but what about 12.4?

the tcl script is pretty simple:

...

typeahead "<ftp_server>"

typeahead $hostname

exec "copy running-config ftp://<ftp_server>/"

When I execute the script, console still waits for input, and the script executes when I tap enter twice like I did it straight from the CLI. Kron will fail when attempting to run this kind of script.

Is a software upgrade the only solution to make typeahead work as intended? If not, is SNMP the only way to copy the configs to a remote location? Or is SNMP "THE" way to do it?

Many thanks,

Wojciech Owczarek

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

Don't use TCL and kron (besides, you can't use typeahead outside of tclsh). The interaction is buggy at best. I see two solutions for you here. The first is to configure "file prompt quiet" on this device. Then the copy command should not be interactive. The second is to convert the kron policy to an Embedded Event Manager policy. This could be as simply as:

event manager applet copy_config

event timer cron cron-entry "0 * * * *"

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "file prompt quiet"

action 4.0 cli command "end"

action 5.0 cli command "copy runn ftp://..."

action 6.0 cli command "config t"

action 7.0 cli command "no file prompt quiet"

action 8.0 cli command "end"

Another alternative is to use EEM and TCL which will allow you to run interactive commands, and do more powerful scripting operations.

The downside of the EEM approaches is that they will not work on 12.2(25)SG. However, they will work on your other devices. The kron/file prompt quiet mechanism should work on all platforms.

If you want more details on EEM, see http://www.cisco.com/en/US/docs/ios/12_4t/netmgmt/configuration/guide/t_eemo.html .

View solution in original post

2 Replies 2

Joe Clarke
Cisco Employee
Cisco Employee

Don't use TCL and kron (besides, you can't use typeahead outside of tclsh). The interaction is buggy at best. I see two solutions for you here. The first is to configure "file prompt quiet" on this device. Then the copy command should not be interactive. The second is to convert the kron policy to an Embedded Event Manager policy. This could be as simply as:

event manager applet copy_config

event timer cron cron-entry "0 * * * *"

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "file prompt quiet"

action 4.0 cli command "end"

action 5.0 cli command "copy runn ftp://..."

action 6.0 cli command "config t"

action 7.0 cli command "no file prompt quiet"

action 8.0 cli command "end"

Another alternative is to use EEM and TCL which will allow you to run interactive commands, and do more powerful scripting operations.

The downside of the EEM approaches is that they will not work on 12.2(25)SG. However, they will work on your other devices. The kron/file prompt quiet mechanism should work on all platforms.

If you want more details on EEM, see http://www.cisco.com/en/US/docs/ios/12_4t/netmgmt/configuration/guide/t_eemo.html .

Thanks a lot, the "file prompt quiet" option was what I needed, just didn't do enough research. Although, as I am currently using SNMP on all the devices, I think I will go for using SNMP. Both methods have pros and cons - with SNMP I can get all the configs with one run of a perl script, but not when the server dies, besides I will have to keep the RW community string in my script. With EEM/kron I will have to configure all the devices to back up the configuration files, but once configured, they will do it all for me.

Thanks again,

Wojciech

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: