28 lines
922 B
Python
28 lines
922 B
Python
import paramiko
|
|
|
|
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)
|
|
|
|
print("=== UPSC METRICS ===")
|
|
stdin, stdout, stderr = ssh.exec_command('upsc server-closet@127.0.0.1')
|
|
print(stdout.read().decode())
|
|
|
|
print("=== NUT.CONF ===")
|
|
stdin, stdout, stderr = ssh.exec_command('grep -v "^#" /etc/nut/nut.conf | grep -v "^$"')
|
|
print(stdout.read().decode())
|
|
|
|
print("=== UPS.CONF ===")
|
|
stdin, stdout, stderr = ssh.exec_command('grep -v "^#" /etc/nut/ups.conf | grep -v "^$"')
|
|
print(stdout.read().decode())
|
|
|
|
print("=== UPSMON.CONF ===")
|
|
stdin, stdout, stderr = ssh.exec_command('grep -v "^#" /etc/nut/upsmon.conf | grep -v "^$"')
|
|
print(stdout.read().decode())
|
|
|
|
ssh.close()
|
|
|
|
if __name__ == '__main__':
|
|
main()
|