cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4606
Views
0
Helpful
6
Replies

ASR 9000 configuration backup

jorgensor
Level 1
Level 1

Hi,

Need a simple script (TCL/EEM) that backs up running-config of an ASR9k router on a daily basis.

Destination FTP och SFTP via a VRF

/Jorgen

 

6 Replies 6

xthuijs
Cisco Employee
Cisco Employee

this is maybe even nicer, we set a trigger on the MGBL commit from XR and then trigger a config backup right away:

event syslog pattern "%MGBL-CONFIG-6-DB_COMMIT : Configuration committed by user"

for more detail on the setup of eem check here:

https://supportforums.cisco.com/document/59496/using-embedded-event-manager-eem-ios-xr-asr9000-simulate-ecmp-min-links

 

here is an example script:

::cisco::eem::event_register_syslog
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*

array set arr_einfo [event_reqinfo]


if [catch {cli_open} result] {
    error $result $errorInfo
} else {
    array set cli1 $result
}

array set _sinfo [sys_reqinfo_routername]
set _info_routername $_sinfo(routername)
if [catch {cli_write $cli1(fd) "copy run tftp"} _cli_result] {
    error $_cli_result $errorInfo
}

if [catch {cli_read_pattern $cli1(fd) "Address"} _cli_result] {
    error $_cli_result $errorInfo
}

if [catch {cli_write $cli1(fd) "w.x.y.z"} _cli_result] {
    error $_cli_result $errorInfo
}

if [catch {cli_read_pattern $cli1(fd) "filename"} _cli_result] {
    error $_cli_result $errorInfo
}

if [catch {cli_exec $cli1(fd) } _cli_result] {
    error $_cli_result $errorInfo
}

action_syslog msg 

# Close open cli before exit.
catch {cli_close $cli1(fd) $cli1(tty_id)} result

namnguyenptit
Level 1
Level 1

I have this problem too

Can anyone help us?

What problem are you having? How about you configure the router to do the backup each time the config is changed, take a look at the following:

https://supportforums.cisco.com/document/12735651/xr-configuration-auto-backup

Regards

Eddie. 

Thankyou!

But one more thing. When I use auto-save command there's a problem:

my ftp server's name: cisco

Password: snoc@123

When I excute the command: configuration commit auto-save filename ftp://cisco:snoc@123@192.168.1.1/config.cfg

The system cant understand the server IP 192.168.1.1 but 123@192.168.1.1

Is there anyway to troubleshoot this? (I cant change password because it is related to many other things).

Thanks!

Break it down as such and see if it works. Else you might need to change the password:

configuration commit auto-save filename ftp://123.29.0.147/config.cfg

ftp client password snoc@123

ftp client username cisco

let me know how it goes. 

Eddie. 

It's OK now.

Thanks verymuch!