#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False) cmd = r""" systemctl is-active caddy curl -sS -m 20 -o /dev/null -w 'dylive=%{http_code} t=%{time_total}s\n' https://dylive.nomadro.com/api/health || echo dylive_fail curl -sS -m 15 -o /dev/null -w 'dy=%{http_code} t=%{time_total}s\n' https://dy.nomadro.com/api/health || echo dy_fail curl -sS -m 8 -o /dev/null -w 'dylive_local=%{http_code}\n' -k https://127.0.0.1/api/health -H 'Host: dylive.nomadro.com' || true journalctl -u caddy -n 50 --no-pager ss -lntp | grep -E ':80|:443' | head -10 """ _, o, e = c.exec_command(cmd, timeout=90) print((o.read() + e.read()).decode()) c.close()