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

42 lines
1.4 KiB
Python

import json
import paramiko
HOST = "107.173.30.245"
USER = "root"
PASSWORD = "Xiao4669805"
DB_PATH = "/opt/douyinWEB/backend/data/monitor.db"
def main() -> None:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, 22, USER, PASSWORD, timeout=30, allow_agent=False, look_for_keys=False)
cmd = (
'python3 -c "import sqlite3, json; '
f"conn=sqlite3.connect('{DB_PATH}'); "
'out={'
"'blacklist': int(conn.execute('SELECT count(*) FROM blacklist').fetchone()[0]),"
"'rooms': int(conn.execute('SELECT count(*) FROM rooms').fetchone()[0]),"
"'sessions': int(conn.execute('SELECT count(*) FROM sessions').fetchone()[0]),"
"'events': int(conn.execute('SELECT count(*) FROM events').fetchone()[0]),"
"'channel_groups': int(conn.execute('SELECT count(*) FROM channel_groups').fetchone()[0]),"
"'shorts_channels': int(conn.execute('SELECT count(*) FROM shorts_channels').fetchone()[0]),"
"'shorts_jobs': int(conn.execute('SELECT count(*) FROM shorts_jobs').fetchone()[0])"
"}; "
'print(json.dumps(out, ensure_ascii=False))"'
)
_stdin, stdout, stderr = c.exec_command(cmd, timeout=60)
out = stdout.read().decode("utf-8", "replace").strip()
err = stderr.read().decode("utf-8", "replace").strip()
print("OUT:", out)
if err:
print("ERR:", err)
c.close()
if __name__ == "__main__":
main()