* moved checkers back to individual workers
parent
e824ee1775
commit
363946c9a5
|
@ -51,10 +51,10 @@ function notify() {
|
||||||
msg="$label is DOWN"
|
msg="$label is DOWN"
|
||||||
elif [[ "$2" == "0" ]]; then
|
elif [[ "$2" == "0" ]]; then
|
||||||
msg="$label is back UP"
|
msg="$label is back UP"
|
||||||
fi
|
fi
|
||||||
curl -X POST -H 'Content-Type: application/json'\
|
curl -X POST -H 'Content-Type: application/json'\
|
||||||
-d '{"chat_id": "'"$k"'", "text": "'"$msg"'", "disable_notification": false}'\
|
-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
|
done
|
||||||
else
|
else
|
||||||
echo "not supported (yet)"
|
echo "not supported (yet)"
|
||||||
|
|
|
@ -3,4 +3,7 @@
|
||||||
|
|
||||||
cfg[useragent]="dtr/1.0 (https://git.sakamoto.pl/domi/dtr)"
|
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
|
||||||
|
|
|
@ -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"
|
|
|
@ -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
|
|
@ -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
|
|
@ -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,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source "${cfg[namespace]}/code/notify.sh"
|
Loading…
Reference in New Issue