Files
SnarfCode/scripts/check_longhorn_settings.py

30 lines
1.1 KiB
Python

import sys
import paramiko
sys.stdout.reconfigure(encoding='utf-8')
def main():
for name, ip in [("aerodrome", "140.44.4.11"), ("spaceport", "140.44.4.41")]:
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"=== LONGHORN SETTINGS ON {name} ({ip}) ===")
settings = [
'auto-salvage-volume',
'detach-manually-attached-volume-with-missing-node',
'replica-replenishment-wait-interval',
'pod-deletion-for-node-down-failure-handling',
'backup-target'
]
for s in settings:
cmd = f"sudo kubectl get setting.longhorn.io {s} -n longhorn-system -o jsonpath='{{.value}}' 2>/dev/null || echo 'not found'"
stdin, stdout, stderr = ssh.exec_command(cmd)
val = stdout.read().decode().strip()
print(f" {s}: {val}")
ssh.close()
if __name__ == '__main__':
main()