Я использую этот способ:
servers = ["192.168.100.161", "192.168.100.162", "192.168.100.163"]
top_command = "top -b -n 1"
host_config = make_host_config(servers)
client = ParallelSSHClient(servers, timeout=2, num_retries=1, retry_delay=1, host_config=host_config)
try:
output = client.run_command(top_command, sudo=True)
print([(k, [x for x in v.stdout], [x for x in v.stderr]) for (k, v) in output.items()])
for host, host_response in output:
print(host, host_response)
except Exception as e:
print("failed to connect some host: ", e)
Что я получаю сейчас: исключение.
не удалось подключиться к некоторому хосту: ("Ошибка подключение к хосту «% s:% s» -% s - повтор% s /% s »,« 192.168.100.161 », 22,« timed out », 1, 1)
Что я хочу получить: Ответы от доступных серверов Ошибки от недоступных серверов
Как этого добиться, ребята?