filmov
tv
Python learning | Part 23 |Netmiko Cisco configuration backup to file with time stamp in filename

ะะพะบะฐะทะฐัั ะพะฟะธัะฐะฝะธะต
๐๐ผ๐ฟ ๐๐ผ๐บ๐ฝ๐น๐ฒ๐๐ฒ ๐ฃ๐๐๐ต๐ผ๐ป ๐๐ผ๐ฟ ๐ก๐ฒ๐๐๐ผ๐ฟ๐ธ ๐๐ป๐ด๐ถ๐ป๐ฒ๐ฒ๐ฟ๐ ๐๐ผ๐๐ฟ๐๐ฒ:
๐๐ป๐ฟ๐ผ๐น๐น ๐ณ๐ผ๐ฟ ๐ฏ๐ฒ๐น๐ผ๐ ๐จ๐ฑ๐ฒ๐บ๐ ๐๐น๐ฎ๐๐: ๐๐๐๐ ๐๐๐ซ๐ฌ๐ข๐จ๐ง
๐ซ๐๐๐๐๐๐๐๐๐ ๐น๐๐๐๐๐๐๐ ๐ณ๐๐๐:
To stay updated with my latest videos Please subscribe to my channel by clicking below
This video demonstrates how to take Cisco IOS device configuration backup from the terminal using netmiko and save the file with timestamp.
from netmiko import ConnectHandler
import time
import datetime
IP_LIST = open('15_devices')
for IP in IP_LIST:
print ('\n '+ IP.strip() + ' \n' )
RTR = {
'ip': IP,
'username': 'admin',
'password': 'admin1',
'device_type': 'cisco_ios',
}
try:
net_connect = ConnectHandler(**RTR)
except NetMikoTimeoutException:
print ('Device not reachable.')
continue
except AuthenticationException:
print ('Authentication Failure.')
continue
except SSHException:
print ('Make sure SSH is enabled in device.')
continue
print ('Initiating cofig backup')
SAVE_FILE = open("RTR_"+IP +'_'+ str(TNOW), 'w')
SAVE_FILE.write(output)
SAVE_FILE.close
print ('Finished config backup')
#CiscoConfigbackupNetmiko
#CiscoPythonBackup
#CiscoScheduleBackup
๐๐ป๐ฟ๐ผ๐น๐น ๐ณ๐ผ๐ฟ ๐ฏ๐ฒ๐น๐ผ๐ ๐จ๐ฑ๐ฒ๐บ๐ ๐๐น๐ฎ๐๐: ๐๐๐๐ ๐๐๐ซ๐ฌ๐ข๐จ๐ง
๐ซ๐๐๐๐๐๐๐๐๐ ๐น๐๐๐๐๐๐๐ ๐ณ๐๐๐:
To stay updated with my latest videos Please subscribe to my channel by clicking below
This video demonstrates how to take Cisco IOS device configuration backup from the terminal using netmiko and save the file with timestamp.
from netmiko import ConnectHandler
import time
import datetime
IP_LIST = open('15_devices')
for IP in IP_LIST:
print ('\n '+ IP.strip() + ' \n' )
RTR = {
'ip': IP,
'username': 'admin',
'password': 'admin1',
'device_type': 'cisco_ios',
}
try:
net_connect = ConnectHandler(**RTR)
except NetMikoTimeoutException:
print ('Device not reachable.')
continue
except AuthenticationException:
print ('Authentication Failure.')
continue
except SSHException:
print ('Make sure SSH is enabled in device.')
continue
print ('Initiating cofig backup')
SAVE_FILE = open("RTR_"+IP +'_'+ str(TNOW), 'w')
SAVE_FILE.write(output)
SAVE_FILE.close
print ('Finished config backup')
#CiscoConfigbackupNetmiko
#CiscoPythonBackup
#CiscoScheduleBackup
ะะพะผะผะตะฝัะฐัะธะธ