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>
63 lines
2.4 KiB
Python
63 lines
2.4 KiB
Python
# -*- 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=30, allow_agent=False, look_for_keys=False)
|
|
|
|
|
|
def run(cmd, timeout=120):
|
|
_, o, e = c.exec_command(cmd, timeout=timeout)
|
|
out = (o.read() + e.read()).decode("utf-8", "replace").strip()
|
|
print(out[-5000:] if len(out) > 5000 else out, flush=True)
|
|
return out
|
|
|
|
|
|
print("=== DISK ===")
|
|
run("df -h / /opt /tmp; echo ---; df -i / | tail -1")
|
|
print("=== MEM/CPU ===")
|
|
run("free -h; echo ---; nproc; uptime")
|
|
print("=== CLIPS SIZE ===")
|
|
run(
|
|
"du -sh /opt/douyinWEB/backend/data/clips "
|
|
"/opt/douyinWEB/backend/data/clips/yt_long "
|
|
"/opt/douyinWEB/backend/data/covers 2>/dev/null; "
|
|
"echo ---; find /opt/douyinWEB/backend/data/clips -name '*.mp4' 2>/dev/null | wc -l"
|
|
)
|
|
print("=== CLIP AGE BUCKETS ===")
|
|
run(
|
|
r"""python3 - <<'PY'
|
|
from pathlib import Path
|
|
import time
|
|
root=Path('/opt/douyinWEB/backend/data/clips')
|
|
now=time.time()
|
|
buckets={'<6h':[0,0], '6-24h':[0,0], '24-48h':[0,0], '>48h':[0,0]}
|
|
for p in root.rglob('*.mp4'):
|
|
try:
|
|
st=p.stat(); age=now-st.st_mtime; sz=st.st_size
|
|
except OSError:
|
|
continue
|
|
key='>48h' if age>48*3600 else '24-48h' if age>24*3600 else '6-24h' if age>6*3600 else '<6h'
|
|
buckets[key][0]+=1; buckets[key][1]+=sz
|
|
for k,(n,s) in buckets.items():
|
|
print(f'{k}: files={n} GB={s/1024/1024/1024:.2f}')
|
|
print('yt_long', sum(1 for _ in (root/'yt_long').glob('*.mp4')) if (root/'yt_long').is_dir() else 0)
|
|
PY"""
|
|
)
|
|
print("=== TOP CPU ===")
|
|
run("ps aux --sort=-%cpu | head -12")
|
|
print("=== FFMPEG/SERVICES ===")
|
|
run("ps aux | grep -E 'ffmpeg|douyinweb-api|douyinweb-web' | grep -v grep | head -25")
|
|
print("=== SETTINGS ===")
|
|
run(
|
|
r"""cd /opt/douyinWEB/backend && PYTHONPATH=. .venv/bin/python - <<'PY'
|
|
from app import db
|
|
m=db.get_settings_map()
|
|
keys=['yt_long_max_concurrent','yt_long_live_sample_batch','yt_long_source_daily_max','yt_long_daily_max','clips_max_age_hours','yt_long_delete_clip_after_upload','shorts_delete_clip_after_upload','tiktok_delete_clip_after_upload','x_clips_delete_clip_after_post','clip_cascade_enabled','yt_long_min_sec','yt_long_max_sec','shorts_max_concurrent','tiktok_max_concurrent','x_clips_max_concurrent']
|
|
print({k:m.get(k) for k in keys})
|
|
PY"""
|
|
)
|
|
c.close()
|