Last active
November 19, 2022 11:07
-
-
Save clemensgg/b796ed84a12dddfd415b9b8bd67f65bc to your computer and use it in GitHub Desktop.
monitor_kujira_oracle.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VALIDATOR="<KUJIRAVALOPERADDRESS>" | |
LCD="<http://YOUR-ENDPOINT:1317>" | |
# create your slack integration: https://api.slack.com/apps | |
SLACK_WEBHOOK="<http://YOUR-SLACK-WEBHOOK-ENDPOINT>" | |
NOW=`date '+%F'`; | |
echo "$NOW Starting oracle-monitoring script..." | |
# Check every 60 seconds if the missing vote count increases. If more than 3 misses votes in 60 sec, alert | |
while (true); do | |
missed_votes=$(curl -s $LCD/oracle/validators/$VALIDATOR/miss | jq ".miss_counter" | sed s/\"//g) | |
sleep 60 | |
last_missed_votes=$(curl -s $LCD/oracle/validators/$VALIDATOR/miss | jq ".miss_counter" | sed s/\"//g) | |
difference=$(expr $last_missed_votes - $missed_votes) | |
NOW=`date '+%F_%H:%M:%S'`; | |
echo "$NOW current missed / slashing window: $last_missed_votes - diff (1min): $difference" | |
if [[ "$difference" -ge 3 ]] ; then | |
NOW=`date '+%F_%H:%M:%S'`; | |
TEXT="$NOW PRICE-FEEDER: 3 or more oracle votes missed during the past 1min! -> $difference" | |
echo $TEXT | |
curl -X POST -H 'Content-type: application/json' --data '{"text":"'"$TEXT"'"}' $SLACK_WEBHOOK | |
fi | |
done; | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment