Technologies Used

Python Netmiko

In real-world network environments, configuration backups are critical for disaster recovery, compliance, and operational stability. I designed and developed a Python-based automation tool that performs scheduled backups of network device configurations over SSH.

The system reads device details dynamically from an Excel inventory file, establishes secure SSH connections using Netmiko, retrieves the running configuration, and stores the backups in structured, timestamped directories. To ensure reliability, the script includes exception handling for authentication failures and connection timeouts, logging unsuccessful devices separately for operational visibility.

One of the core objectives of this project was to eliminate manual intervention and create a scalable, repeatable backup process. The script runs automatically at defined intervals using a scheduling mechanism, making it suitable for continuous production use.

Key Responsibilities & Implementation Highlights

  • Automated SSH connections to multiple devices
  • Dynamic inventory parsing via Excel
  • Structured timestamp-based backup storage
  • Robust exception handling and failure logging
  • Scheduled execution for periodic backups

Core Device Connection Logic

device = {
    "device_type": sheet.row(i)[5].value,
    "ip": sheet.row(i)[2].value,
    "username": sheet.row(i)[3].value,
    "password": sheet.row(i)[4].value,
    "port": 22
}

connectdevice = ConnectHandler(**device)
fetch = connectdevice.send_command("show running-config", read_timeout=300)

This logic dynamically builds the device connection parameters and retrieves the running configuration securely over SSH.

Scheduled Automation

schedule.every(3600).seconds.do(doJob)

while True:
    schedule.run_pending()
    time.sleep(3600)

The automation runs every hour, ensuring configuration backups are continuously maintained without manual intervention.