Files
SnarfCode/scripts/check_ctl02_uptime.py

19 lines
555 B
Python

import paramiko
import sys
sys.stdout.reconfigure(encoding='utf-8')
key_path = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet"
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
client.connect("140.44.4.42", username="root", key_filename=key_path, timeout=5)
stdin, stdout, stderr = client.exec_command("uptime; uname -r; modprobe veth; lsmod | grep veth")
print("OUTPUT from ctl02:")
print(stdout.read().decode('utf-8'))
client.close()
except Exception as e:
print("Connect error:", e)