douyinWEB/scripts/_diag_cpu_services.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 22:42:40 -05:00

30 lines
1.2 KiB
Python

#!/usr/bin/env python3
import sys
import paramiko
if hasattr(sys.stdout, "reconfigure"):
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=45, allow_agent=False, look_for_keys=False)
cmds = [
"uptime; nproc; free -h | head -2",
"ps aux --sort=-%cpu | head -18",
"docker stats --no-stream 2>/dev/null | head -12 || true",
"systemctl is-active douyinweb-api douyinweb-web netdata docker 2>/dev/null; systemctl list-units --type=service --state=running --no-pager 2>/dev/null | head -40",
"pgrep -a ffmpeg || echo no_ffmpeg",
"grep -E 'update every|dbengine|page cache' /etc/netdata/netdata.conf 2>/dev/null | head -20 || ls /etc/netdata/ 2>/dev/null | head",
"cat /proc/sys/vm/swappiness; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null || echo no_cpufreq",
]
for cmd in cmds:
print("===", cmd[:70], "===")
_, o, e = c.exec_command(cmd, timeout=40)
print(o.read().decode("utf-8", "replace")[:2500])
err = e.read().decode("utf-8", "replace").strip()
if err:
print("ERR:", err[:400])
print()
c.close()