feat(power): complete Phase 7 Power Resilience & UPS Automation deployment and verification
This commit is contained in:
23
scripts/test_nut_alert.py
Normal file
23
scripts/test_nut_alert.py
Normal file
@@ -0,0 +1,23 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user