rodneymo / rig-monitor

monitoring solution for mining rigs
https://randomcryptostuff.blogspot.nl/2017/08/monitoring-ethereum-mining-farm-using.html
GNU General Public License v3.0
30 stars 12 forks source link

Support for EWBF zcash miner #20

Closed wishbone1138 closed 7 years ago

wishbone1138 commented 7 years ago

We should consider getting EWBF working. It's only for zcash but does have a nice API that even reports current GPU power draw. I plan on looking into it soon.

https://bitcointalk.org/index.php?topic=1707546.0

wishbone1138 commented 7 years ago

I got EWBF (ZEC Miner) working last night as well using influxdb but I haven't pushed it yet because it doesn't integrate with the rest of the configuration and I didn't know what "schema" you wanted to go with in the change over to influxdb. It's ridiculously simple though. Here's a preview.

#!/bin/bash
RIGNAME='ZECMINER'
RIG_IP='10.1.1.120'
INFLUXDB_IP='localhost'
#NOW=`date`

#EWFB
CURLOUT=`curl -s -m 5 "http://$RIG_IP:42000/getstat"`

if [ "$CURLOUT" == "" ]; then
        echo "CURL FAILED"
        curl -s -i -m 5 -XPOST "http://$INFLUXDB_IP:8086/write?db=rigdata" --data-binary "rig_info,rig_id=$RIGNAME online=0"
else
        echo "CURL SUCCESS"
        curl -s -i -m 5 -XPOST "http://$INFLUXDB_IP:8086/write?db=rigdata" --data-binary "rig_info,rig_id=$RIGNAME online=1"
        INFLUXDB_INPUT=`echo $CURLOUT | jq -r '.result | .[] | [.gpuid,.speed_sps,.accepted_shares,.rejected_shares,.temperature,.gpu_power_usage,.gpu_status] | @csv' \
                        | awk -v RIGNAME="$RIGNAME" -F "," \
                        '{print "rig_stats,rig_id="RIGNAME",miner=EWBF,gpu_id="$1",coin=ZEC gpu_hashrate="$2",gpu_shares="$3"i,gpu_rej_shares="$4"i,gpu_temp="$5"i,gpu_fan=0i,gpu_power="$6i",gpu_status="$7"i"}'`
fi
curl -s -i -m 5 -XPOST 'http://localhost:8086/write?db=rigdata' --data-binary "$INFLUXDB_INPUT"
wishbone1138 commented 7 years ago

I'm pretty happy with my code on this. Seems to be working well. I'll clean it up and add it as a dynamic module to our new setup.

rodneymo commented 7 years ago

awesome

rodneymo commented 7 years ago

Thanks for the script. Great job.

rodneymo commented 7 years ago

@wishbone1138 could you check my last commit? I think you have a few typos on the ewbf miner script. Just to make sure

wishbone1138 commented 7 years ago

Just a habit I got into with influxdb. I call out the integers. It can be an issue if someone else tries to write to the database and does not specifically call out the "i", but no one else should be writing to that same measurement. I figured it was a space saving feature to not write everything as floats (the default if no i is present). I'm assuming that's what you mean? I think there is at least one typo in there though. I put an "i" next to a variable and not within quotes. I'm totally ok with writing everything as floats if you prefer.

rodneymo commented 7 years ago

ah ok. Makes sense. I didn't even know that was possible. So that should save some storage space. Just rollback the change.

I think we can close this one, right?

wishbone1138 commented 7 years ago

no worries. I think I need to fix one area anyway.