15 lines
589 B
Python
15 lines
589 B
Python
import paramiko
|
|
|
|
def find_prom(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}) ===")
|
|
_, o, _ = c.exec_command("kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}/status: {.metadata.name}{ \"\\t\" }{.spec.containers[*].image}{\"\\n\"}{end}' | grep -i prom")
|
|
print(o.read().decode())
|
|
c.close()
|
|
|
|
find_prom('140.44.4.11', 'Aerodrome')
|
|
find_prom('140.44.4.41', 'Spaceport')
|
|
|