cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1172
Views
0
Helpful
4
Replies

automatic backup issue with kron

mod0108537733
Level 1
Level 1

Hi all,

Every month I have to issue these commands for backup at my network devices

#show run

#show version

# show diag

now I have around more than 200 network device form routers and switches so I go to automatic backup from cisco by using kron command

I use

# kron policy-list backup

#cli show run | redirect tftp://192.168.10.1/R1-run

#cli show ver | redirect tftp://192.168.10.1/R1-ver

#cli show diag | redirect tftp://192.168.10.1/R1-ver

 

but every command ''must'' have its own file for output ,can I find any solution to make all outputs of these three commands combined in one file automatically by the router

 

BR

Mahmoud

1 Accepted Solution

Accepted Solutions

ghostinthenet
Level 7
Level 7

Well, there's a short answer and a long answer.

The short answer is to use "cli show tech-support | redirect tftp://192.168.10.1/R1-tech-support" instead. The output of this command includes all three of the items you're looking for and quite a bit more.

The long answer is to use an EEM script to combine things before sending.

event manager applet EEM_Status
 event timer cron cron-entry "* * 1 * *"
 action 1.0 cli command "enable"
 action 2.0 cli command "delete /force flash:/status"
 action 3.0 cli command "show running-config | redirect flash:/status"
 action 4.0 cli command "show version | append flash:/status"
 action 5.0 cli command "show diag | append flash:/status"
 action 6.0 cli command "copy flash:/status tftp://192.168.10.1/R1-status"
 action 6.0 exit

This script will combine all three commands into a file on the flash called "status" at midnight on the first of each month and then TFTP that file to your server.

View solution in original post

4 Replies 4

ghostinthenet
Level 7
Level 7

Well, there's a short answer and a long answer.

The short answer is to use "cli show tech-support | redirect tftp://192.168.10.1/R1-tech-support" instead. The output of this command includes all three of the items you're looking for and quite a bit more.

The long answer is to use an EEM script to combine things before sending.

event manager applet EEM_Status
 event timer cron cron-entry "* * 1 * *"
 action 1.0 cli command "enable"
 action 2.0 cli command "delete /force flash:/status"
 action 3.0 cli command "show running-config | redirect flash:/status"
 action 4.0 cli command "show version | append flash:/status"
 action 5.0 cli command "show diag | append flash:/status"
 action 6.0 cli command "copy flash:/status tftp://192.168.10.1/R1-status"
 action 6.0 exit

This script will combine all three commands into a file on the flash called "status" at midnight on the first of each month and then TFTP that file to your server.

Thanks Jody for your reply

can I customize the output of this command

#cli show tech-support

The "show tech-support" command doesn't have any options, so no. If you want granular control of the output, I would go with the EEM approach.

I made these commands and it worked great

event manager applet backup
 event timer cron cron-entry "45 13 19 10 *"
 action 1.0 cli command "enable"
 action 2.0 cli command "delete /force flash:/status"
 action 3.0 cli command "show running-config | redirect flash:/status"
 action 4.0 cli command "show version | append flash:/status"
 action 5.0 cli command "show diag | append flash:/status"
 action 6.0 cli command "copy flash:/status tftp:" pattern "Address or name of remote host.*"
 action 7.0 cli command "192.168.10.1" pattern "Destination filename.*"
 action 8.0 cli command "R1-status"

Review Cisco Networking for a $25 gift card