* moved checkers back to individual workers

master
Dominika Liberda 2021-06-12 11:12:08 +00:00
parent e824ee1775
commit 363946c9a5
11 changed files with 24 additions and 33 deletions

View File

@ -51,10 +51,10 @@ function notify() {
msg="$label is DOWN"
elif [[ "$2" == "0" ]]; then
msg="$label is back UP"
fi
fi
curl -X POST -H 'Content-Type: application/json'\
-d '{"chat_id": "'"$k"'", "text": "'"$msg"'", "disable_notification": false}'\
"https://api.telegram.org/bot${cfg[telegram_bot_token]}/sendMessage" > /dev/null
"https://api.telegram.org/bot${cfg[telegram_bot_token]}/sendMessage" -vvv > /dev/stderr
done
else
echo "not supported (yet)"

View File

@ -3,4 +3,7 @@
cfg[useragent]="dtr/1.0 (https://git.sakamoto.pl/domi/dtr)"
worker_add checker 60
worker_add every_1min 60
worker_add every_5min 300
worker_add every_30min 1800
worker_add notify 60

View File

@ -1,30 +0,0 @@
#!/bin/bash
if [[ "$counter5" == '' ]]; then
counter5=5
else
counter5=$((counter5+1))
fi
if [[ "$counter30" == '' ]]; then
counter30=30
else
counter30=$((counter30+1))
fi
source "${cfg[namespace]}/code/ping.sh" every_1min
source "${cfg[namespace]}/code/req.sh" every_1min
source "${cfg[namespace]}/code/port.sh" every_1min
if [[ $counter30 == 30 ]]; then
source "${cfg[namespace]}/code/ping.sh" every_30min
source "${cfg[namespace]}/code/req.sh" every_30min
source "${cfg[namespace]}/code/port.sh" every_30min
counter30=0
fi
if [[ $counter5 == 5 ]]; then
source "${cfg[namespace]}/code/ping.sh" every_5min
source "${cfg[namespace]}/code/req.sh" every_5min
source "${cfg[namespace]}/code/port.sh" every_5min
counter5=0
fi
source "${cfg[namespace]}/code/notify.sh"

5
workers/every_1min/worker.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
source "${cfg[namespace]}/code/ping.sh" every_1min
source "${cfg[namespace]}/code/req.sh" every_1min
source "${cfg[namespace]}/code/port.sh" every_1min

View File

5
workers/every_30min/worker.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
source "${cfg[namespace]}/code/ping.sh" every_30min
source "${cfg[namespace]}/code/req.sh" every_30min
source "${cfg[namespace]}/code/port.sh" every_30min

View File

5
workers/every_5min/worker.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
source "${cfg[namespace]}/code/ping.sh" every_5min
source "${cfg[namespace]}/code/req.sh" every_5min
source "${cfg[namespace]}/code/port.sh" every_5min

0
workers/notify/control Normal file
View File

3
workers/notify/worker.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
source "${cfg[namespace]}/code/notify.sh"