import paramiko c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect('140.44.4.11', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10) _, o, _ = c.exec_command("kubectl get configmap prometheus-config -o json") import json data = json.loads(o.read().decode().strip()) prom_yml = data.get("data", {}).get("prometheus.yml", "") print("Length of prometheus.yml in CM:", len(prom_yml)) print("Contains shipyard:", "shipyard" in prom_yml) if "shipyard" in prom_yml: for line in prom_yml.splitlines(): if "shipyard" in line: print(" ", line) else: print("Last 20 lines of prometheus.yml:") for line in prom_yml.splitlines()[-20:]: print(" ", line) c.close()