cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Python Script using Netmiko Lib to SSH into network devices and retrieve basic information

826
Views
5
Helpful
4
Comments

import netmiko
from netmiko import ConnectHandler
device = ConnectHandler(device_type="cisco-ios, ip="IP ADDRESS", username="USENAME", password="PASSWORD", secret="ENABLE PASSWORD")
output1 = device.send_command("show running-config")

print(output1)
device.disconnect()

Comments
Beginner
Please, Krishna, how can I use this script? On what device and what are the prerequisites?

 

Hi @liviu000111 Greetings. There is not prerequisite, Just install python on machine with any IDE and and run the given script to access your Cisco routers and switches and your are set. But its good to have some basic understanding of python to understand the script and optimize as per your need.

 

Thanks

Krishna

Beginner
Hi, Krishna, Question: This netmico is some library?

Hi @liviu000111  Yes, Its a multi vendor python library to SSH into network devices.its support multiple vendors. You can google it for more detail.

 

Thanks

Krishna

CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards