import paramiko ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('140.44.4.71', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10) def run(cmd): print(f">>> {cmd}") _, o, e = ssh.exec_command(cmd) out = o.read().decode().strip() err = e.read().decode().strip() if out: print(out) if err: print("[stderr]", err) run("systemctl status zabbix-agent2") run("grep -E '^Server|^Hostname|^HostMetadata' /etc/zabbix/zabbix_agent2.conf") run("tail -n 25 /var/log/zabbix/zabbix_agent2.log") ssh.close()