diff --git a/monitoring.sh b/monitoring.sh new file mode 100755 index 0000000..598a01f --- /dev/null +++ b/monitoring.sh @@ -0,0 +1,77 @@ +#!/bin/bash +#empfaenger="+491608271789" + + +#function send_message () { +# #echo "Message: $1" +# for telefon in $empfaenger +# do +# echo -e "$1" | signal-cli -u +4915223927526 send $telefon +## echo "echo -e \"$1\" \| signal-cli -u +4915223927526 send $telefon" +## echo "signal-cli -u +4915223927526 send -m \"$1\" $telefon" +# done +#} +function send_message() { + + +curl \ + --silent \ + `#--insecure --proxy "$CURLPROXY" ` \ + --form-string "token=a5ju5wf34goaqr4juzpeuf2v4iuf4b" \ + --form-string "user=u44drxvefhqrehxid8f131d9v5nit4" \ + --form-string "message=$PUSHOVERMESSAGE" \ + --form-string "title=$PUSHOVERTITLE" \ + --form-string "priority=" \ + --form-string "device=" \ + https://api.pushover.net/1/messages.json + +} + + + +#ping -c 4 -i mullvad 8.8.8.8 +#Mullvad test +if ! ping -c 4 -I mullvad 8.8.8.8 > /dev/null 2>&1 +then +# echo "Mullvad-Tunnel broken" + fehler=1 + fehlermeldung="$fehlermeldung Mullvad" +#else +# echo "OK" +fi + +#fff-has test +if ! ping -c 4 -I fff-has 10.50.252.158 > /dev/null 2>&1 +then +# echo "GRE fff-has broken" + fehler=1 + fehlermeldung="$fehlermeldung fff-has" +#else +# echo "OK" +fi + + +if ! ping -c 4 -I fff-has2 10.50.252.160 > /dev/null 2>&1 +then +# echo "GRE fff-has2 broken" + fehler=1 + fehlermeldung="$fehlermeldung fff-has2" +#else +# echo "OK" +fi + + +if ! ping -c 4 -I fff-wue1 10.50.252.164 > /dev/null 2>&1 +then +# echo "GRE fff-wue1 broken" + fehler=1 + fehlermeldung="$fehlermeldung fff-wue1" +#else +# echo "OK" +fi + + +if [ "$fehler" = "1" ] +then + send_message "`hostname`\nFehler: $fehlermeldung down" +fi