Saturday, October 24, 2020
Automate your network device backup with a excel sheet and python - Part 2
Enter your full device inventory to a excel sheet and use it for backup your devices. with below python script your select/filter devices required to backed up.
Full Sheet in one shot backup see the Part 1
Example:
>py Backup_Devices.py>python Backup_Devices.py
- Step1 - Will prompt the excel sheet headings to select.
- Step2 - Once you selected the heading it will prompt all the unique values from the row you selected
- Step3 - Selected devices will be printed on console for verification and prompt for authentication details of selected device
Once all set, Script will start to backup the device an stored into the folders.
File Path of backup file
BASE DIR > Current Year > Current Month > Current Date > Device_Location
File Name
IP_address_Current-Date-&-Time.txt
Script is written using below python libraries
- Netmiko - For SSH and Telnet to the device and read the output.
- Xlrd - For reading data and formatting information from Excel (xls or .xlsx files)
- prettytable - To print tables in an attractive ASCII form
Download a copy from:
https://github.com/arazzan/network_backup_with_python.git
Excel Sheet Sample A1. Device_Location *required B1. Serial_Number C1. Device_Name_or_Hostname *required D1. Device_type - Platform Support and more details in below link *required https://pynet.twb-tech.com/blog/automation/netmiko.html E1. IP_address (hostname also supported, if DNS can resolve to IP) *required F1. Software_Version G1. Model Number H1. Access_Method
Labels:
automation,
backup,
filter,
inventory,
netmiko,
network,
prettytable,
python,
xlrd,
xls
Automate your network device backup with a excel sheet and python - Part 1
Script is written using below python libraries
- Netmiko - For SSH and Telnet to the device and read the output.
- Xlrd - For reading data and formatting information from Excel (xls or .xlsx files)
- prettytable - To print tables in an attractive ASCII form
Download a copy from:
https://github.com/arazzan/network_backup_with_python.git
Excel Sheet Sample
A1. Device_Location *required
B1. Serial_Number
C1. Device_Name_or_Hostname *required
D1. Device_type - Platform Support and more details in below link *required
https://pynet.twb-tech.com/blog/automation/netmiko.html
E1. IP_address (hostname also supported, if DNS can resolve to IP) *required
F1. Software_Version
G1. Model Number
H1. Access_Method
Example: Backup all the devices listed in the excel sheet.
>py Backup_Devices.py
>python Backup_Devices.py
Please enter authentication details for template book "MyDevicesUploadTemplate""MyDevicesUploadTemplate" need to placed with this app folderEnter User Name : adminEnter Password :
* Authentication details of devices need to be type in. User account should have privileges to read the running config.
Once all set, Script will start to backup the device an stored into the folders.
File Path of backup file
BASE DIR > Current Year > Current Month > Current Date > Device_Location
File Name
IP_address_Current-Date-&-Time.txt
Subscribe to:
Comments (Atom)


