Ssh_session = netmiko.ConnectHandler(device_type='cisco_ios', ip=device_row, Ssh_password = getpass.getpass('SSH Password: ') Parser.add_argument('-c', '-csv', required=True, action='store', help='Location of CSV file') Parser = ArgumentParser(description='Arguments for running oneLiner.py') Here's a script, the result of 10 minutes work with some limited error checking: #!/usr/bin/env python3 This can be done from the command line with simple redirection or you can create another file object variable for writing and write to it. Pass your commands and store output to a text file. Pass the IP of the router to the netmiko and required credentials. Once installed take a look at this great link with a lot of good examples.Īlso if you are looking to do this command across many devices that support SSH then from a script perspective I suggest you store all of your routers IP addresses on a text file and create your script with the following structure. So if you have python installed with root or admin privileges execute the command pip install netmiko. First I suggest you install the Paramiko ssh library and its name is Netmiko.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |