douyinWEB/scripts/_diag_neko_now.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

41 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
import paramiko
HOST = "108.174.50.68"
REMOTE = r"""#!/usr/bin/env bash
set -euo pipefail
echo "=== docker ps ==="
docker ps -a --filter name=douyinweb-neko
echo "=== neko1 inspect ==="
docker inspect douyinweb-neko-1 --format 'status={{.State.Status}} health={{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}}'
echo "=== neko1 logs ==="
docker logs --tail 60 douyinweb-neko-1 2>&1
echo "=== curl ==="
curl -sS -o /dev/null -w 'local_root=%{http_code}\n' http://127.0.0.1:9200/
curl -sS -o /dev/null -w 'local_prefix=%{http_code}\n' http://127.0.0.1:9200/neko/1/
curl -sS -o /dev/null -w 'nginx_prefix=%{http_code}\n' -k https://127.0.0.1/neko/1/ -H 'Host: dy.nomadro.live'
echo "=== profile perms ==="
ls -la /opt/douyinWEB/backend/data/neko/profiles/1/ 2>/dev/null | head -10
echo "=== free mem ==="
free -h
"""
def main() -> int:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False)
stdin, stdout, stderr = c.exec_command(REMOTE, timeout=120)
print(stdout.read().decode("utf-8", "replace"))
err = stderr.read().decode("utf-8", "replace")
if err.strip():
print("STDERR:", err)
print("exit", stdout.channel.recv_exit_status())
c.close()
return 0
if __name__ == "__main__":
raise SystemExit(main())