Monitoring delegations and rewards as a validator of ShipChain

in monitoring •  4 years ago  (edited)

Script for monitoring rewards and total delegations in Grafana

This will be a short and straightforward tutorial on how to set up a script and monitoring the output in Grafana.

Firstly, follow shipmateFRnl's guide on how to set up Grafana, Telegraf, and InfluxDB here.

Installing the script

My full script for monitoring your delegations and rewards is posted here. An alternative to my script if you have multiple wallets, is the script of ShipChainEurope which can be downloaded here. However, it uses different paths as me, so you’d have to edit it accordingly. To install the script, follow the commands posted here one by one:

  • $ mkdir ./filedump/ Here we make a directory where all text and JSON files will be generated because we don't want to clog our working directory.
  • $ nano ./filedump/stakerewards.sh and copy and paste the script here. Then press CTRL+\ to find & replace user with your own username. Press CTRL+O to save the file and then CTRL+X to exit the text editor.
  • Make the script executable by running the command $ chmod +x ./filedump/stakerewards.sh
  • Now run the command crontab -e and then copy-paste the following at the bottom of the file */30 * * * * /home/user/filedump/stakerewards.sh and by replacing user with your own username.
    This will cause the script the run every 30 minutes.

Monitoring the output files of the script

Configuring Telegraf

  • Copy-paste this at the bottom of your Telegraf configuration file.
    $ sudo nano /etc/telegraf/telegraf.conf then press CTRL+\ to find & replace user with your own username. Press CTRL+O to save the file and then CTRL+X to exit the text editor.
  • $ sudo systemctl restart telegraf to restart the Telegraf service.
  • $ sudo systemctl status telegraf to verify there are no errors.

Configuring Grafana

  • Install Farksi Blenstat panel with $ sudo grafana-cli plugins install farski-blendstat-panel
  • Restart Grafana $ sudo systemctl restart grafana-server
  • Now go to the Grafana page in your web browser on your desktop, something like IP-address:3000if you didn't change your default port yet. There we will import the following JSON that can be downloaded here. How the other inputs that are used in this dashboard will be covered in a future post. Alternatively, you can add and configure the panels yourself in an existing dashboard.

If you successfully followed all steps, you should see all rewards, delegations, and their current market price in Grafana.

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!