Monday, September 6, 2021

Automation Optimization - simultaneous netmiko ssh connections

I'm writing a python script to get the interface names of the management interfaces. Basically it's "show ip interface brief | include mgmt_ip" and from there, I get my interface name (Vlan100, or GigabitEthernet2/0). Thing is, it takes 2-5 seconds to connect issue the command, get the data and close the connection. For a few hundred devices, this will take a few hours to run, and 99.999% of that is waiting for the switches to respond.

Is there a way to "hyperthread" this? As in, run ~10 or so simultaneous SSH connections and not have each of them wait for the previous to finish? Preferably without getting a PHD in Python first. I don't care much about reordering the data, I can just sort it afterwards.



No comments:

Post a Comment