Files
ai-customer-service/guest-cs-stack/_debug_webhook.py
T
2026-08-15 14:51:51 +08:00

26 lines
948 B
Python

import os
import paramiko
pw = os.environ["DEPLOY_PASSWORD"]
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("20.191.152.26", username="wakka", password=pw, timeout=30)
cmds = [
"""sudo docker exec guest-chat-postgres-1 psql -U postgres -d chatwoot_production -c "SELECT id,name,outgoing_url FROM agent_bots;" """,
"""sudo docker exec guest-chat-postgres-1 psql -U postgres -d chatwoot_production -c "SELECT id,status,content FROM messages ORDER BY id DESC LIMIT 5;" """,
"sudo docker logs guest-chat --tail 120 2>&1",
"sudo docker exec guest-chat printenv MAXKB_BASE_URL MAXKB_BRIDGE_ENABLED CHATWOOT_AGENT_BOT_TOKEN",
]
for cmd in cmds:
print("===", cmd[:90])
_, o, e = c.exec_command(cmd, timeout=90)
out = o.read().decode(errors="replace")
err = e.read().decode(errors="replace")
print(out[:4000])
if err.strip():
print("ERR:", err[:300])
c.close()