From 57af09460fac496beac1b83665c17e10a0416b9e Mon Sep 17 00:00:00 2001 From: Corrado Mulas Date: Fri, 8 Apr 2022 23:32:09 +0000 Subject: [PATCH] Aggiungi 'notifier' ZM custom notification script for motion detection filter Usage: /path/to/script/notifier "%EPIM%" "%MN%" "%ET%" "%MP%" "%EC%" "%ESM%" "%ED%" "%ESA%" "%EL%" "%EP%" Remember to apply x permissions before executing for the first time. --- notifier | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 notifier diff --git a/notifier b/notifier new file mode 100644 index 0000000..e327149 --- /dev/null +++ b/notifier @@ -0,0 +1,45 @@ +#!/bin/sh +TELEGRAM_BOT_TOKEN="" +TLMSG="[SECURITY OPERATIONS CENTER]\n\nATTENZIONE \ +\n\nMovimento rilevato su $2 alle $3. \ +\ +\n\nMonitor: $4 \ +\nCausa: $5 (punteggio max. $6) \ +\nDescrizione: $7 \ +\ +\n\nPunteggio medio: $8 \ +\nDurata: $9 \ +\ +\n\nEvento: $10" + + +MESSAGE="ATTENZIONE \ + +Movimento rilevato su $2 alle $3. \ +\ +Monitor: $4 \ +Causa: $5 (punteggio max. $6) \ +Descrizione: $7 \ +\ +Punteggio medio: $8 \ +Durata: $9 \ +\ +Evento: $10" + +#PUSHOVER POST SECTION +curl -F "token=" \ +-F "user=" \ +-F "title=Allarme TVCC TRN1" \ +-F "message=$MESSAGE" \ +-F "priority=2" \ +-F "expire=3600" \ +-F "retry=30" \ +https://api.pushover.net/1/messages + +#TELEGRAM POST SECTION +curl -X POST \ + -H 'Content-Type: application/json' \ + -d '{"chat_id": "", "text": "'"$TLMSG"'"}' \ + https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage + +exit 0