Trust you are all doing well.
Grateful if anyone can help or share any tips to achieve the below:
- Perform backup configuration of switches and upload same to a remote server securely.
We are currently performing automatic backup via tftp, however i need to upload the configs files to the client's remote server (offsite).
Is there any way to achieve this, especially the upload part.
I have been looking around, i could only see automatic backup that are uploaded to a server on site.
Can anyone please share anything on this.
Thank you in advance for your time.
...if you then need to get the configs to a clients remote server, then the python script could tar the collected scripts and then scp them to the client server.
This sounds like an interesting challenge. If no one beats me to it I'll try and spin up a script tonight...
Thank you for showing the way. Indeed this is an interesting challenge :)
I will try to come up with something on my side as well.
It took longer than expected as I had to extend it for junos as I only have an SRX to test with at home...
Anyhow, you need to create a CSV with the following format:
device_ip,type 192.168.10.1,cisco_ios 192.168.10.2,cisco_ios 192.168.10.3,juniper_junos
In the directory you are running the script, create a sub-directory called 'output'. The script is run by passing it the CSV as a parameter:
python3 tar_then_rcp.py -c <csv_file>
It will prompt you for a username and password for your network devices, then for username/password of the remote server you are RCP the archive to.
When the script runs it will iterate through the CSV, connect to the network device, scrape the 'sh run' output and write it to a file in ./output . Once all the CSV has been parsed, it will tar the contents of ./output and then RCP the file to the remote server.
The full source can be found here:
You will probably want to clear the contents of the ./output directory after each run of the script.
Also please bear in mind there is very little error checking in the script so it will bomb out if it encounters something unexpected. That said it did a good job of processing the equipment I have at home! :)
Let me know how it goes.
Apologies for the delayed response, I hit a bug myself, got the flu over the weekend :/
Thank you for writing the script. I will run it and will let you know how it goes.
have a nice day ahead mate.