Files
SnarfCode/scripts/inspect_db_env.py
2026-11-03 14:32:06 -05:00

30 lines
1.1 KiB
Python

import paramiko
import sys
sys.stdout.reconfigure(encoding='utf-8')
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('140.44.4.11', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=8)
print("=== AERODROME DB USERS/ENV ===")
for ns, pod in [('infra', 'authentik-postgresql-0'), ('awx', 'awx-postgres-15-0')]:
cmd = f"kubectl get pod {pod} -n {ns} -o jsonpath='{{.spec.containers[0].env}}'"
stdin, stdout, stderr = ssh.exec_command(cmd)
print(f"[{ns}/{pod}] Env: {stdout.read().decode()[:200]}")
ssh.close()
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('140.44.4.41', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=8)
print("=== SPACEPORT DB USERS/ENV ===")
for ns, pod in [('infrastructure', 'gitea-postgresql-0'), ('monitoring', 'zabbix-postgresql-0')]:
cmd = f"kubectl get pod {pod} -n {ns} -o jsonpath='{{.spec.containers[0].env}}'"
stdin, stdout, stderr = ssh.exec_command(cmd)
print(f"[{ns}/{pod}] Env: {stdout.read().decode()[:200]}")
ssh.close()