22 lines
914 B
Python
22 lines
914 B
Python
#!/usr/bin/env python3
|
|
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("108.174.50.68", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
|
|
cmds = [
|
|
'docker ps -a --format "table {{.Names}}\t{{.Status}}\t{{.Image}}"',
|
|
"pgrep -a ffmpeg | head -15; echo ffmpeg_count=$(pgrep -c ffmpeg || true)",
|
|
"docker ps -q --filter name=neko | wc -l; docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}' 2>/dev/null | head -30",
|
|
]
|
|
for cmd in cmds:
|
|
print(f"\n===== {cmd[:80]} =====", flush=True)
|
|
_i, o, e = c.exec_command(cmd, timeout=60)
|
|
print(o.read().decode("utf-8", "replace"), end="", flush=True)
|
|
err = e.read().decode("utf-8", "replace")
|
|
if err.strip():
|
|
print("[stderr]", err, flush=True)
|
|
c.close()
|