Files
SnarfCode/scripts/check_unhealthy_pods.py

17 lines
571 B
Python

import paramiko
def check(ip, name):
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(ip, username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
print(f"=== {name} ({ip}) Non-running Pods ===")
_, o, _ = c.exec_command("kubectl get pods -A --no-headers | grep -v -E 'Running|Completed'")
res = o.read().decode().strip()
print(res if res else "All pods are Running/Completed!")
c.close()
check('140.44.4.11', 'Aerodrome')
print()
check('140.44.4.41', 'Spaceport')