import paramiko import time c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("140.44.44.121", username="rancher", password="Katzir476!", timeout=10) chan = c.invoke_shell() time.sleep(2) if chan.recv_ready(): chan.recv(4096) def run(cmd): chan.send(cmd + "\r\n") time.sleep(3) out = "" while chan.recv_ready(): out += chan.recv(8192).decode(errors='ignore') return out print("Spacedock / Harvester pods with prom:") print(run("sudo kubectl get pods,svc -A | grep -i prom")) c.close()