almeira-web/scripts/check_vps.py

28 lines
884 B
Python

import paramiko
import sys
HOST = "161.97.93.156"
USER = "carlos"
PASSWORD = "Innova1978+*?"
try:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(HOST, username=USER, password=PASSWORD, timeout=10)
stdin, stdout, stderr = ssh.exec_command('docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"')
print("=== DOCKER PS ===")
print(stdout.read().decode('utf-8'))
stdin, stdout, stderr = ssh.exec_command('docker logs --tail 30 dripzone-production 2>&1')
print("=== DRIPZONE PRODUCTION LOGS ===")
print(stdout.read().decode('utf-8'))
stdin, stdout, stderr = ssh.exec_command('ps aux | grep -E "docker|build" | grep -v grep')
print("=== RUNNING BUILDS / PROCESSES ===")
print(stdout.read().decode('utf-8'))
ssh.close()
except Exception as e:
print("Error:", e)