19 lines
784 B
Python
19 lines
784 B
Python
#!/usr/bin/env python3
|
|
import paramiko
|
|
PASS = "Xiao4669805"
|
|
CMD = r"""
|
|
curl -sS -m 4 -o /dev/null -w 'health:%{http_code}\n' http://127.0.0.1:8014/api/health
|
|
systemctl is-active douyinweb-api douyinweb-web
|
|
systemctl is-active douyinweb-neko-watch.service 2>/dev/null || echo no_watch_unit
|
|
grep -c cdp_ok /usr/local/bin/neko_health_watch.sh 2>/dev/null || echo 0
|
|
pgrep -af neko_health_watch || true
|
|
"""
|
|
for label, host in [("dy", "108.174.50.68"), ("dylive", "107.173.30.245")]:
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(host, 22, "root", PASS, timeout=35, allow_agent=False, look_for_keys=False)
|
|
_, o, e = c.exec_command(CMD, timeout=40)
|
|
print("====", label)
|
|
print((o.read() + e.read()).decode())
|
|
c.close()
|