In this tutorial, I will explain how Kron jobs work on Cisco in
order to perform an automatic backup of our Cisco equipment.
cisco(config)#kron policy-list backup-conf-trought-tftp-server
cisco(config-kron-policy)#cli show running-config | redirect tftp://192.168.0.19/lab-alpha-r-cisco-890-confg
cisco(config-kron-policy)#exit
cisco(config)#kron occurrence backup-conf-trought-tftp-server at 00:30 Tue recurring
cisco(config-kron-occurrence)#policy-list backup-conf-trought-tftp-server
cisco(config-kron-occurrence)#end
cisco#show clock
cisco#show run
cisco#write
VERIFY
cisco#sh kron schedule
cisco#debug kron all
% create many archive files marked with time of création and override config file
def add_Kron(ipdev):
username=''
passwd=''
enablepass=''
cisco_sw = {
'device_type': 'cisco_ios',
'host': ipdev,
'username': username,
'password': passwd,
'secret':enablepass,
}
swConnect = ConnectHandler(**cisco_sw)
swConnect.enable()
swConnect.send_command(enablepass)
#self.swConnect.send_command('sh int des')
config_commands = ['conf t', 'kron occurrence backup at 01:00 1 recurring', 'policy-list backup', 'exit', 'kron policy-list backup', 'cli copy running-config tftp://192.168.3.22/'+ipdev,'cli write', 'end', 'wr']
swConnect.send_config_set(config_commands)
addrs=['15','14','4','10','113','116','19','2','18']
for addr in addrs:
print('WRITE TO 172.31.31.'+addr)
add_Kron('172.31.31.'+addr)
R1(config)#archive
R1(config-archive)#log
R1(config-archive)#log ?
config Logging changes to the running configuration
R1(config-archive)#log config
R1(config-archive-log-cfg)#?
commands for controlling config logging:
default Set a command to its defaults
exit Exit from the log config submode
hidekeys suppress output (e.g. passwords) when displaying logged commands
logging Modify config logging parameters
no Negate a command or set its defaults
notify Send logged commands to target applications
record What to record in the config logger
R1(config-archive-log-cfg)#logging ?
enable Enable the config logger
persistent Log configuration persistent
size Maximum number of logged commands that will be kept by the config
log
R1(config-archive-log-cfg)#hidekeys
R1(config-archive-log-cfg)#exit
R1(config-archive)#path tftp://192.168.3.222/$h-
% create many archive files marked with time of création no override config file
R1(config-archive)#time-period 1
% Archive within 1 munite
R1(config-archive)#write-memory
% archive when you apply wr cli
R1(config-archive)#do sh archive
The maximum archive configurations allowed is 14.
The next archive file will be named tftp://192.168.3.222/R1--0
Archive # Name
1
2
3
4
5
6
7
8
9
10
R1(config-archive)#
%Error opening tftp://192.168.3.222/R1--0 (Socket error)
No comments:
Post a Comment