As mentioned in the previous post the v2.x is a complete re-write in Golang. You can read the reasons for the re-write in Golang here.

What’s new in version 2.2:

  • Support for Fairpool
  • Support for power usage monitoring of Wemo smart plugs.
  • Supports power management rules and logic. Automatically can rigs – via TP-Link and  Wemo smart plugs – based on power consumption, hashrate or any other available KPI in influxDB (power mgmt rules).
  • Ability to trigger custom scripts (e.g. control external device that resets rig PSU) based on power consumption, hashrate or any other available KPI in influxDB (power mgmt rules).
  • Launch remote management applications like ssh or Team Viewer directly from Grafana dashboards.
  • Automatic reload of rig, pool and power management rules in case of configuration file changes, during runtime. Other settings are not updated during runtime.
  • CastXMR now includes “mining_time”.
  • Several minor improvements and bug fixes.

Complete feature list:

  • Single executable for monitoring pools, rigs, power and market data with support for logging, tracing.
  • Custom config file replaced with toml-based config file.
  • Ability to pool thousands of rigs and dozens of pools simultaneously.
  • Power management rules and logic. Automatically reset rigs – via TP-Link or Wemo smart plugs – based on power consumption, hashrate or any other available KPI.
  • Ability to trigger custom scripts (e.g. control external device that resets rig PSU) via power management rules.
  • Automatic reload of rig, pool and power management rules in case of configuration file changes, during runtime.
  • Miner support
    • Claymore (tested v11.6)
    • Xmr-stak (tested v2.4.2)
    • Sgminer (tested v5.5.5)
    • SRBMiner
    • XMRig-Proxy
    • PhoenixMiner (tested v2.9e)
    • CastXMR
  • pool support
    • Nanopool (all coins)
    • Ethermine (all coins)
    • Fairpool (all coins)
    • Mpos based pools e.g. miningpoolhub.com (all coins)
    • Nodejs-pool based pools e.g. hashvaultpro.com (all coins)
  • Power monitoring using smart plugs
  • TP-Link HS110 (v1.0 and v2.0 hardware)
    • Wemo Insight
  • Market data monitoring
  • Data storage using influxDB
  • Cross-platform support
    • raspberry Pi 1 Model B/ARMv6
    • raspberry Pi 2/3/ARMv7
    • linux/x86-64
    • macOS/x86-64
    • windows/i386
    • windows/x86-64
    • Launch remote management applications like ssh or Team Viewer from Grafana
  • Dashboard examples (templates) for all supported miners and pools
  • Notifications via Telegram

Enough of that. On with the installation instructions.

Pre-requisites:

  1. sqlite3 – This is required by grafana to store metadata. Installation instructions in grafana installation step
  2. Python 2.7 (optional). Only needed if you are planning to use the TP-Link HS110 smart-plugs
  3. influxDB 1.5.2
  4. Grafana 5.1.2

Installation Instructions

Install influxDB

  • Download and installation instructions for version 1.5.2 are here
  • Configure influxDB. Edit /etc/influxdb/influx.conf file. Make sure the following options are set:
[http] section
enabled = true
bind-address = 8086
  • Login to influxDB using the influx client
influx
  • Create and select rig-monitor DB
create database rigdata
use rigdata
  • Create user and grant permissions to grafana user
create user grafana with password 'grafana'
grant all privileges to grafana

Install Grafana

  • Download Grafana 5.1.2 and installation instructions here. For arm-based devices download it here.
  • Install grafana.  Instructions for the different target platforms here.
  • Configure grafana. Edit /etc/grafana/grafana.ini file. Make sure the following options are set:
    • [database] section
      type = sqlite3
      [security]section
      admin_user = admin
      admin_password = admin
      [auth.basic] section
      enabled = true
  • Setup grafana datasource:
    • Name: rigdata
    • Type: influxBD
    • UTL: http://localhost:8086
    • Access: Server
    • Database: rigdata
    • User: grafana
    • Password: grafana

Install rig-monitor

Download the latest version from here

Each package includes the following files:

  • grm/conf/config.toml – rig-monitor configuration file
  • grm/grm-<version> – rig-monitor executable
  • grm/external/tplink.py – external script for polling TP-link HS110 smart plugs
  • grm/dashboards/dashboard.csv – Dashboard templates

Configure rig-monitor. Explanation of parameters and examples in configuration file.

Import dashboards

Import template dashboards via sqlite:

sudo sqlite3 /var/lib/grafana/grafana.db
sqlite> .separator ","
sqlite> .import dashboards.csv dashboard
sqlite> .quit

If you plan to create a custom version of a template dashboard then strongly suggest to create a copy with a different name it. This will let you to delete older versions of the template and import newer ones without loosing your work. For details on upgrading a specific dashboard take a look at customizing and troubleshooting post.

Configure power management rules

Power management enables rig-monitor to automatically reboot rigs remotely if certain measurements go below a define lower limit e.g. hash rate or power comsuption. It currently supports Wemo and TP-Link smart plugs as well as custom scripts (for non-IP devices). You can read more about it here.

Launch SSH or Team Viewer from Grafana dashboards

This integration enables admins to launch Team Viewer or SSH clients directly from Grafana. You can read more about it here.

Set grafana alerts

Grafana supports multiple alert methods. Currently I am using telegram so forward alter notifications to my cell phone. This is how you do it

1. Install Telegram app on your cell phone
2. On your phone open this link. This will open a chat with Telegram’s Botfather
3. Create new bot using /newbot. Then name your bot and give it a username. The bot will reply with a token e.g. 3653462710:AAGgPlkjdflasd78dsf;SDFMAklsadfgDpHzl-AP
4. Create a telegram group and add your bot to it
5. Copy and past the following link to your browser: https://api.telegram.org/bot<TOKEN>/getUpdates. In my case that would be
https://api.telegram.org/bot3653462710:AAGgPlkjdflasd78dsf;SDFMAklsadfgDpHzl-AP/getUpdates

That command should produce an output like this

{"ok":true,"result":[{"update_id":87899789,
"message":{"message_id":2,"from":{"id":762837642,"is_bot":false,"first_name":"John","last_name":"Doe","language_code":"root"},"chat":{"id": 762837642,"first_name":"Rodrigo","last_name":"Fernandes","type":"private"},"date":1503863332,"text":"/help","entities":[{"offset":0,"length":5,"type":"bot_command"}]}}]}
 if the output is simply
 {"ok":true,"result":[]}

then send a couple of messages in the group chat and try again.

6. Write down the id code above we will need it to confirm the notifications in Telegram
7. On Grafana’s main menu go to Alerting / Notifications Channel and click New Channel. Fill in a name, select Type as Telegram, check “Send on all alerts” and “Include image” checkboxes, fill in the BOT API token with the token from step 3 and fill in the “Chat ID” with the ID from step 5.

Access grafana dashboads via SSH tunnel

Open SSH client tunnel with following command

ssh -L 8080:<ip address of raspberry pi>:3000 pi@<dynu hostname> -p 19000

Now go to your browser and enter the following URL: http://localhost:8080
The grafana UI should come up.

Leave me a comment if you have any issues/questions.
—————————————————————————————————–
Did you enjoy this post? Buy me a beer
ETH: 0x0f2d4397CecB53883411cfe75882622c312c8340
MUSICOIN: 0x9a44a57041acd5f1511bf13a663d136ddbde1fb1

16 thoughts on “Version 2.x – Installation Instructions

  1. James Brown says:

    Hi!
    Your rig monitor 2.x looks like a very promising project.
    I am wondering do you plan to open source this project?

    BR,
    J.Brown

    1. rodneymo rodneymo says:

      Hi J.,

      Like I have mentioned in the bitcointalk forum, I am still considering it. The main reason I have not done it in the beginning was my experience with 1.x – a lot of ppl forking, only one guy contributing. But like I said is something it’s not set in stone.

  2. James Brown says:

    Hey,
    Of course everything is up to you.
    Follow your feelings. I wish you success!

    BR,
    J.

  3. James says:

    Hi. I cannot see password parameter for rig. W\o that your program is not usable for me. Can you add it?

    I`m talking about rig configuration:

    #RIG_ID, MINER, PRIMARY_POOL_LABEL, SECONDARY_POOL_LABEL, RIG_URL/IP, INSTALLED_GPUS/THREADS,TARGET_HASHRATE,TARGET_HASHRATE_2nd_COIN,PLUG_TYPE,PLUG_IP,MAX_POWER,MAX_TEMP

    You have RIG_URL/IP, but you do not have RIG_PASSWORD

    1. admin says:

      Hi,

      please create a submission on GitHub

  4. Simon says:

    Hey, how do you run the grm program ? I can’t manage to do it.
    I installed grafana, database, scripts and configured the toml file but I do not see any data in the dashboard. Can you help please ?

    Thanks

    1. rodneymo says:

      Hey Simon,

      if you run grm -t do you see DB-write log entries? They should look like the example below:

      INFO: 2018/06/08 17:31:50 influxdb.go:46: DBDaemon ticker expired (10s). Data points (10) saved to influxDB
      INFO: 2018/06/08 17:32:00 influxdb.go:46: DBDaemon ticker expired (10s). Data points (0) saved to influxDB

      1. Simon says:

        Hi rodneymo,

        Thank you your answer, when I run “grm -t” I have the following error :
        -bash: grm: command not found

        So I found that I didn’t install Go. I did it with those informations : https://golang.org/doc/install

        Then git wasn’t installed too. So I ran “apt-get install git”
        I tried to install grm following the instructions from here : https://github.com/go-grm/grm

        And I still get command not found when I run “grm -t”

        1. rodneymo rodneymo says:

          Hey Simon,

          you don’t need either go, nor git. Which OS are you using? I assume linux. If that’s the case then you need to cd to the grm dir:
          e.g. cd grm-2.2.d5-linux-amd64
          then from within that dir you run: ./grm -t
          Let me know if that helps

          1. Simon says:

            Hi rodneymo,

            Yes it helps. It is working now but only for few minutes.

            Here is what I get when it crashes :

            goroutine 13 [running]:
            go-rig-monitor/miner.parseClaymoreOutputLine(0xc420291c50, 0xc4202c2b40, 0x9e, 0xc420291a00)
            /Users/ramf/go/src/go-rig-monitor/miner/claymore.go:384 +0x2834
            go-rig-monitor/miner.(*RigConfig).LoadClaymmoreData(0xc42000f2c0, 0xc420055e60, 0x8e0e00)
            /Users/ramf/go/src/go-rig-monitor/miner/claymore.go:160 +0x63e
            go-rig-monitor/miner.Monitor(0xc4201e0240, 0xc420055e60)
            /Users/ramf/go/src/go-rig-monitor/miner/rig-monitor.go:28 +0x182
            created by main.main
            /Users/ramf/go/src/go-rig-monitor/main.go:147 +0xc37

          2. rodneymo rodneymo says:

            Ok. I suggest we move this conversation to telegram (https://t.me/joinchat/IuYcwBKqbGqIeXpw9sfq7Q) or GitHub (please create an issue).

            I suspect this is an issue in your config file so I need you to send me both your config file as well as a trace file. For the trace you can run ./grm -t > trace.txt

  5. Nehat says:

    Its possible to set port for tplink smart plugs for example i need to forward ports from 9998 to tplink smart plug 9999 on my router.

    and i can and only a smart plug because i use VPN client to connect Grafana Server on my private LAN Network to see rigs for Grafana Server

    1. rodneymo rodneymo says:

      Hi Nehat,

      I am afraid I don’t understand you question. Could you describe your setup and what you are trying to achieve?

      1. Nehat says:

        Hi Rodneymo

        Can i set port number for tlink smart plugs

        for example
        plug 1 ip 192.168.0.1:9999
        plug 2 ip 192.168.0.2:9998
        plug 3 ip 192.168.0.3:9997

        1. rodneymo rodneymo says:

          hey,

          AFAIU the port is always 9999 so that’s not possible. As you mentioned on your 1st comment, maybe using the router’s port mapping.

Leave a Reply to rodneymo Cancel reply

Your email address will not be published. Required fields are marked *