# -*- coding: utf-8 -*- import paramiko c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("192.168.110.207", username="root", password="123456", timeout=30) cmds = [ "uptime; free -h | head -2", "systemctl is-active docker k3s litellm 2>/dev/null; systemctl is-enabled docker k3s litellm 2>/dev/null", "docker ps -a --format 'table {{.Names}}\t{{.Status}}' | head -60", "ss -tlnp | grep -E ':80 |:3000|:4000|:9997|:18080|:8001|:8929|:30080|:30088|:9092|:3001' || true", "export KUBECONFIG=/etc/rancher/k3s/k3s.yaml; k3s kubectl get nodes 2>&1 | head -5; k3s kubectl get pods -A 2>&1 | head -40", ] for cmd in cmds: print("===", cmd[:80]) _, o, e = c.exec_command(cmd, timeout=60) print(o.read().decode(errors="replace")) err = e.read().decode(errors="replace") if err.strip(): print("ERR:", err[:800]) c.close()