29 lines
916 B
Python
29 lines
916 B
Python
import paramiko
|
|
|
|
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=10)
|
|
|
|
def run(cmd):
|
|
print(f"=== {cmd} ===")
|
|
_, out, err = ssh.exec_command(cmd)
|
|
res = out.read().decode().strip()
|
|
if res:
|
|
print(res)
|
|
e = err.read().decode().strip()
|
|
if e:
|
|
print("ERR:", e)
|
|
|
|
# Check Coder
|
|
run("kubectl get deploy,sts,pod -n infrastructure -l app.kubernetes.io/name=coder -o wide")
|
|
run("kubectl get deploy,sts,pod -n infrastructure | grep -E 'coder|gitea|zabbix'")
|
|
|
|
# Inspect Gitea details
|
|
run("kubectl get deploy,sts -n infrastructure -o wide")
|
|
|
|
# Check Coder images
|
|
run("kubectl get deploy -n infrastructure -o jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{range .spec.template.spec.containers[*]}{.image}{\" \"}{end}{\"\\n\"}'")
|
|
|
|
ssh.close()
|
|
|