Ugly Bash script does the job

in witness-update •  28 days ago

As a witness, I use many different checks to monitor the reliability of my nodes. After few issues some time I got a good understanding which scripts can really catch the issue at an early stage and which ones are completely useless and do nothing after all.

When I started my journey I had running conductor in kill-switch mode to track missing blocks and Zabbix to monitor hardware, software and uptime of steemd process. For notifications, I've configured email and PUSH messages through Pushover to get alerts immediately when they occur, but this setup didn't satisfy me. My biggest concern was how to catch the issue before I start missing blocks...

...and this is what I figured out so far,

  • connect to the local RPC endpoint (require rpc-endpoint = in config.ini)
  • get data from database_api get_dynamic_global_properties
  • check the delta between server time and the time of the last synced block

Simple but powerful, because it checks if the steemd process is up and running and also measures the delay time of syncing blockchain. Time is crucial when it comes to producing blocks because the delay of more than 3 seconds will cause your node to start missing blocks.

I wrote a Bash script to gather data and feed Zabbix to trigger actions if delay is >4 seconds. The script can be used to check all kind of nodes.


TIME_WITNESS_RAW=$(curl --silent --connect-timeout 5 $HOST --data '{"id":1,"method":"call","jsonrpc":"2.0","params":["database_api","get_dynamic_global_properties",[]]}' | jq -r '.result.time')
TIME_WITNESS=$(date -u -d "$TIME_WITNESS_RAW" +%s)
TIME_CURRENT=$(date -u "+%s")

echo $DIFF

(*) it uses jq to parse JSON data, but it can be replaced by the grep.

Example usage,

# witness node
$ ./


# seed node
$ ./


# full RPC node
$ ./

I know... The Python is more sexy, but Bash also does the job... ;-)

If you think I will be a good witness, please vote for me.
Thank you!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  Trending

Would you mind if I will post my Flask service that does same job? I'll clearly say where I got the idea from. :-)


It will be great ;-) we’re all here to improve the Steem ;-)

Ha, wyprzedziłeś mnie. Mam podobny skrypt i też chciałem go opisać. :-)


To jest chyba najprostsze rozwiązanie które daje stosunkowo dużą pewność, że node działa prawidłowo. ;-)

There is nothing like a quick and dirty bash script that gets the job done!


Agree, if it's stupid but it works it isn't stupid ;->


yes, all my steem projects start like that..and this is the result:

$ crontab -l|wc -l