From 81d63d25b2b86c9947d4ca4ab782ea33ce8e1732 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 28 May 2021 11:44:52 +0000 Subject: [PATCH] =?UTF-8?q?=E2=80=9Eprtg=5Fapprise=5Fnotify.ps1=E2=80=9C?= =?UTF-8?q?=20hinzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prtg_apprise_notify.ps1 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 prtg_apprise_notify.ps1 diff --git a/prtg_apprise_notify.ps1 b/prtg_apprise_notify.ps1 new file mode 100644 index 0000000..7da2413 --- /dev/null +++ b/prtg_apprise_notify.ps1 @@ -0,0 +1,24 @@ +# Das Skript muss 2x unter C:\Program Files (x86)\PRTG Network Monitor\Notifications\EXE abgelegt werden. +# Im PRTG müssen neue Vorlagen für Benachrichtigung angelegt werden. Einmal für failed und einmal für recover. +# Das Skript für recover anpassen. +# In der Benachrichtigungsvorlage muss "Programm ausführen" benutzt werden. Dort das jeweilige Skript auswählen. +# Als Parameter folgendes Eintragen: '%device' '%name' +# Im Prtg muss anschließend noch der Trigger angepasst werden. Rechte Maustaste auf Hauptgruppe -> Bearbeiten -> +# Trigger für Benachrichtigung. Dort dann die eben erstellten Vorlagen hinterlegen. + +### Vars +$USER="MatrixUsername" +$PASS="MatrixPw" +$SERVER="MatrixServer" +$ROOMID="MatrixRoomId" +$url="AppriseURL" +$device = $args[0] +$sensor = $args[1] +$JSON = @" +{ + "urls":"matrixs://$USER`:$PASS@$SERVER/$ROOMID", + "body":"Der Sensor $sensor ist nicht mehr erreichbar.", + "title":"$device hat ein Problem!" +} +"@ + Invoke-RestMethod -Uri $url -Method Post -Body $JSON -ContentType "application/json" \ No newline at end of file