python - Paramiko hangs when running on 150+ servers while running simple commands -


i'm trying run multiple commands on bunch of remote servers using python's paramiko module.

the commands i'm trying run simple commands, such cat, lspci(with grep) , small script 1 line output.

the thing is, if provide few machines (~50), works fine. problem starts when try run script on many machines.

try:     ssh = paramiko.sshclient()     ssh.set_missing_host_key_policy(paramiko.autoaddpolicy())     ssh.connect(host, username='root', password='pass')     transport = ssh.get_transport()     channel = transport.open_session()     stdin, stdout, stderr = ssh.exec_command(cmd)     line in stdout.readlines():         line = line.strip()          sheet1.write(row_line,0,host,style_cell) # writing xls file         sheet1.write(row_line,1,line,style_cell) # writing xls file      while channel.recv_ready():         channel.recv(1024)      ssh.close()  expect:     print stdout     print stderr 

this stdout,stderr get:

paramiko.channelfile paramiko.channel 2 (eof received) (open) window=2097152 paramiko.transport @ 0xce44c9d0l (cipher aes128-ctr, 128 bits) (active; 2 open channel(s)) 

please advice,

thanks!

maybe it's problem specific servers. try outputting server causes errors , see if can recreate problem if running script specific server.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -