Files
SnarfCode/scripts/check_nut_services.py

21 lines
702 B
Python

import paramiko
import sys
sys.stdout.reconfigure(encoding='utf-8')
def main():
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('14.4.4.44', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
stdin, stdout, stderr = ssh.exec_command('systemctl status nut-monitor --no-pager')
print("STATUS NUT-MONITOR:\n", stdout.read().decode('utf-8', errors='replace'))
stdin, stdout, stderr = ssh.exec_command('systemctl status nut-server --no-pager')
print("STATUS NUT-SERVER:\n", stdout.read().decode('utf-8', errors='replace'))
ssh.close()
if __name__ == '__main__':
main()