feat: add various infrastructure check and automation scripts
This commit is contained in:
28
scripts/check_nut_configs.py
Normal file
28
scripts/check_nut_configs.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
KEY_FILE = r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet'
|
||||
IP = '14.4.4.44'
|
||||
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect(IP, username='snarf', key_filename=KEY_FILE, timeout=10)
|
||||
|
||||
def run(cmd):
|
||||
print(f"\n>>> {cmd}")
|
||||
_, o, e = ssh.exec_command(cmd)
|
||||
out = o.read().decode().strip()
|
||||
if out:
|
||||
print(out)
|
||||
return out
|
||||
|
||||
run("uptime")
|
||||
run("cat /etc/nut/nut.conf")
|
||||
run("cat /etc/nut/ups.conf")
|
||||
run("cat /etc/nut/upsmon.conf | grep -v '^#' | grep -v '^$'")
|
||||
run("ps aux | grep -i nut")
|
||||
run("ls -la /run/nut")
|
||||
|
||||
ssh.close()
|
||||
|
||||
Reference in New Issue
Block a user