Files
SnarfCode/scripts/check_longhorn_version.py

16 lines
833 B
Python

import paramiko
def check_lh(ip, cluster):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(ip, username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
print(f"\n[{cluster}] Checking Longhorn images...")
_, out, _ = ssh.exec_command("kubectl get daemonset -n longhorn-system longhorn-manager -o jsonpath='{.spec.template.spec.containers[0].image}{\"\\n\"}'")
print("Manager image:", out.read().decode().strip())
_, out, _ = ssh.exec_command("kubectl get volumes.longhorn.io -n longhorn-system -o custom-columns=NAME:.metadata.name,ROBUSTNESS:.status.robustness,STATE:.status.state | head -n 10")
print(out.read().decode().strip())
ssh.close()
check_lh('140.44.4.11', 'AERODROME')
check_lh('140.44.4.41', 'SPACEPORT')