-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidator-monitoring.sh
47 lines (33 loc) · 1.28 KB
/
validator-monitoring.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## OL validator monitoring scripts. The first alerts if a validator is unhealthy.
## The second confirms validator health. Separate into separate files and run scrips as cron jobs.
## Ideally someone picks this up and combines the two scripts into a single script.
# Alerts to unhealthy validator, run often, e.g. every 5 minutes.
#!/bin/bash
TOKEN=$YOUR_TELEGRAM_BOT_TOKEN
CHAT_ID=$YOUR_TELEGRAM_CHAT_ID
URL="https://api.telegram.org/bot$TOKEN/sendMessage"
MESSAGE="Ol Validator Unhealthy"
/$HOME/bin/ol health | grep false
RESULT=$?
echo -e "Grep identified as: $RESULT"
if [ $RESULT == 0 ]; then
echo -e $MESSAGE
# Send to Telegram
curl -s -X POST $URL -d chat_id=$CHAT_ID -d text="$(echo -e $MESSAGE)"
fi
# Confirm validator health, run a few times per day as a sanity check.
/$YOURPATH/conf-monitor-0l-status.sh
*/5 * * * * /$YOURPATH/conf-monitor-0l-status.sh >> /$YOURPATH/conf-monitor-0l-status.sh.log
#!/bin/bash
TOKEN=$YOUR_TELEGRAM_BOT_TOKEN
CHAT_ID=$YOUR_TELEGRAM_CHAT_ID
URL="https://api.telegram.org/bot$TOKEN/sendMessage"
MESSAGE="Ol Validator Healthy"
/$HOME/bin/ol health | grep false
RESULT=$?
echo -e "Grep identified as: $RESULT"
if [ $RESULT == 1 ]; then
echo -e $MESSAGE
# Send to Telegram
curl -s -X POST $URL -d chat_id=$CHAT_ID -d text="$(echo -e $MESSAGE)"
fi