#!/usr/bin/env python3 """Read-only health check on dylive after youtube_neko sync — no changes.""" from __future__ import annotations import json import sys import time import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") HOST = "107.173.30.245" PASS = "Xiao4669805" def main(): c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) for i in range(6): try: c.connect(HOST, 22, "root", PASS, timeout=30, allow_agent=False, look_for_keys=False) break except Exception as e: print(e, flush=True) time.sleep(1 + i) else: raise SystemExit("ssh_fail") cmd = r""" echo '=== units ===' for u in douyinweb-api douyinweb-web douyinweb-pb douyinweb-yt; do printf '%-18s %s\n' "$u" "$(systemctl is-active $u 2>/dev/null)" done echo '=== hash marker ===' grep -n 'relay may leave Chrome\|_neko_ids_for_cdp_poll\|Evidence-first' /opt/douyinWEB/backend/app/youtube_neko.py | head -10 echo '=== api smoke ===' curl -sS -m 8 http://127.0.0.1:8014/api/health || true echo cd /opt/douyinWEB/backend ./.venv/bin/python - <<'PY' import json from app import youtube_neko, yt_assign_db ids = youtube_neko._neko_ids_for_cdp_poll() print('cdp_poll_ids', ids) # enabled groups still included enabled=[] running_disabled=[] for g in yt_assign_db.list_groups(include_urls=False): nid=int(g.get('neko_instance_id') or 0) if nid<1: continue en=bool(g.get('neko_enabled')) try: run=bool(youtube_neko._container_state(nid, check_http=False).get('running')) except Exception: run=False if en: enabled.append(nid) if (not en) and run: running_disabled.append(nid) print('enabled_neko_ids', sorted(set(enabled))) print('running_disabled_ids', sorted(set(running_disabled))) # any active relay row studio snap try: from app.youtube_relay_pipeline import youtube_relay_pipeline st = youtube_relay_pipeline.status() if hasattr(youtube_relay_pipeline,'status') else None except Exception as e: st=None print('relay_status_err', type(e).__name__, str(e)[:120]) # light: groups with running neko + snap for g in yt_assign_db.list_groups(include_urls=False): nid=int(g.get('neko_instance_id') or 0) if nid not in ids: continue snap=youtube_neko.studio_snapshot_for_group(g, max_age_sec=180) print('SNAP', g.get('name'), 'neko', nid, 'en', g.get('neko_enabled'), 'page', snap.get('live_page_open'), 'air', snap.get('on_air'), 'viewers', snap.get('viewer_count'), 'src', snap.get('detect_source') or snap.get('ui_source')) PY echo '=== ffmpeg ===' pgrep -c ffmpeg || echo 0 echo '=== neko running ===' docker ps --filter name=douyinweb-neko --format '{{.Names}} {{.Status}}' 2>/dev/null """ _i, o, e = c.exec_command(cmd, timeout=90) print(o.read().decode("utf-8", "replace"), flush=True) err = e.read().decode("utf-8", "replace") if err.strip(): print("[stderr]", err[:1500], flush=True) c.close() print("CHECK_DONE", flush=True) if __name__ == "__main__": main()