I've noticed a few witness have been having stale price feeds. They usually get around to fixing it, but sometimes it takes a few days.
I run a simple script that monitors my price feed and alerts me if it is stale by over 8 hours.
There are a lot of reasons why a price feed may be stale, sometimes the script trips up and needs to be restarted, or node issues prevent the your feed from broadcasting. Whatever the reason, knowing when your feed is stale is extremely helpful and responsible as a witness.
Below you will find the script I use to monitor my feed and use Pushover to send me a Push notification when it is stale. Feel free to use it and change out the notification service for something you prefer.
You will need python, Beem, and a Pushover account to use this script. You are free to use it as you please. I recommend using something like PM2 to keep it running.
import requests
import time
from beem import Hive
from beem.witness import Witness
from datetime import datetime, timedelta, timezone
witnesses = []
feed_time_threshold = 8 * 60 * 60
delay = 60 * 60
pushover_endpoint = 'https://api.pushover.net/1/messages.json'
pushover_app_key = ''
pushover_key = ''
def send_pushover_notification(message):
requests.post(pushover_endpoint, data={"token": pushover_app_key,
"user": pushover_key, "message": message})
def get_witness_feed_update_time(witness):
return Witness(witness)['last_hbd_exchange_update']
def check_witness_feed(witness, date):
print(witness, datetime.now(timezone.utc) - date)
if (datetime.now(timezone.utc) - date).total_seconds() > feed_time_threshold:
send_pushover_notification(f"{witness} feed is stale")
while(True):
for witness in witnesses:
check_witness_feed(witness, get_witness_feed_update_time(witness))
time.sleep(delay)