25 lines
842 B
Python
25 lines
842 B
Python
import paramiko
|
|
import json
|
|
|
|
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)
|
|
|
|
payload = json.dumps({
|
|
"title": "NUT Master Notification Pipeline Verified",
|
|
"message": "Direct alert link verified: 14.4.4.44 -> Gotify VIP (http://140.44.4.70:8090) -> Discord #ups-power channel.",
|
|
"priority": 5
|
|
})
|
|
|
|
curl_cmd = f"curl -s -X POST \"http://140.44.4.70:8090/message?token=A4uN4fEmErGeNcYtOkEn\" -H \"Content-Type: application/json\" -d '{payload}'"
|
|
stdin, stdout, stderr = ssh.exec_command(curl_cmd)
|
|
res = stdout.read().decode()
|
|
print("GOTIFY RESPONSE:", res)
|
|
|
|
ssh.close()
|
|
|
|
if __name__ == '__main__':
|
|
main()
|
|
|