#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import httpx import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") r = httpx.get("https://dy.nomadro.com/api/health", timeout=25) j = r.json() print("health ok", r.status_code) print("monitor", j.get("monitor")) # counts sometimes nested print("keys", [k for k in j.keys() if "count" in k.lower() or k in ("db", "counts", "stats")]) g = paramiko.SSHClient() g.set_missing_host_key_policy(paramiko.AutoAddPolicy()) g.connect("107.173.30.245", 4014, "eric", "4669805", timeout=60, banner_timeout=120, allow_agent=False, look_for_keys=False) _, o, e = g.exec_command( "python3 -c \"import sqlite3; c=sqlite3.connect('/opt/douyinWEB/backend/data/monitor.db'); " "print('rooms', c.execute('select count(*) from rooms').fetchone()[0]); " "print('enabled', c.execute('select count(*) from rooms where enabled=1').fetchone()[0]); " "print('blacklist', c.execute('select count(*) from blacklist').fetchone()[0]); " "print('urls'); " "[print(r[0]) for r in c.execute('select url from rooms limit 5')]\"", timeout=30, ) print((o.read() + e.read()).decode()) g.close()