I spent some time building this rudimentary / retro "dashboard" for watching my little U3 as it tries to win the lottery.
I present BYOTBDOMD - Build Your Own, Text Based, Difficulty Oriented, Mining Dashboard
Here's a screenshot
What you're seeing, clockwise, starting from top left is...
- cgminer 4.9.2
- "blockwatch.sh" - rudimentary script I wrote to monitor cgminer output log for the word block (not sure on the exact wording of log output when a block is found... because I've never found one)
- "best20table.sh" - less rudimentary script I wrote to parse the cgminer output log for accepted shares and show the 20 best shares
- "best20graph.sh" - even less rudimentary script I wrote to plot the 20 best shares as a bar chart with fixed width and height
- "last80table.sh" - script that parses cgminer output log and ouputs the difficulty of the last 80 accepted shares in a table with 20 rows and 4 columns
- "80linegraph.sh" - script to plot the difficulty of the last 80 shares as a line graph that auto senses terminal size and adapts
All of the scripts expect a file called cgminer.log in the same directory. This file is created by appending "2>>cgminer.log" to the end of your cgminer startup command. This file could, of course, be copied locally from elsewhere.
Other requirements: sed, awk, stty, tail, pr, head, sort, feedgnuplot (and all subsequent dependencies)
To get all the scripts on the same screen I used tmux. Other terminal multiplexers like screen or byobu (which is really a screen and tmux front end) will work too.
Why did I build this? Well I wanted something fun to watch as my little U3 churns away trying to solve a block. The only meaningful stats to this end are really difficulty of submitted shares. I didnt find anything to monitor this stat so this is what I came up with. I guess the other meaningful piece of info is whether or not the miner is working and what the hashrate is, but those are readily visible from looking at cgminer itself (I might try to add hashrate as a different line on the big graph for second release, but it will require a little time to put that together).
How to use these? Well, if your miner submits a share with difficulty higher than the network difficulty, then you have solved a block. So look at the Best 20 Shares table for that info. The Best 20 Shares graph is useful as a quick "fingerprint" of your best 20 shares that you can easily glance at. If you notice it has changed shape significantly since last time you looked (specifically, if the height of most of the graph has dropped significantly) then that means you have some new higher difficulty shares. The line graph of last 80 shares just gives you something to look at and last 80 shares table is the corresponding data. Find spikes in the chart and data and you'll see high-difficulty shares.
I'm quite sure no one else will find these scripts useful, but I spent time on them and figured I'd share with the class. I take no responsibility if you stare at them for extended periods hoping to catch your miners hitting a high-difficulty share. At the very least its something retro and techy looking you can show all your friends.
I'm also quite sure these scripts are not in any way well-written or optimized. If you care enough to improve on them, please post them back here.
Here are the scripts:
#last80table.sh - ctrl+c to exit
while true
do
clear
echo "Last 80 Shares"; echo " "; tail -n 160 cgminer.log | sed -n 's/.*Accepted.\{10\}Diff \(.*\)\/.*/\1/p' | tail -n 80 | pr -4 -J -T -l 20
sleep 10
done
#blockwatch.sh - ctrl+c to exit
tail -f cgminer.log | grep -i block
#best20table.sh - ctrl+c to exit
while true
do
clear
echo "Best 20 Shares"; echo " "; sed -n 's/.*Accepted.\{10\}Diff \(.*\)\/.*/\1/p' cgminer.log | sort -hr | head -n 20;
sleep 60
done
#best20graph.sh - ctrl+c to exit
while true
do
clear
termsize=`stty size | awk '{print $2,$1}'`
sed -n 's/.*Accepted.\{10\}Diff \(.*\)\/.*/\1/p' cgminer.log | sort -rh | head -n 20 | awk '/[0-9]$/{print $1;next};/[pP]$/{printf"%u\n", $1(1000*1000*1000*1000*1000);next};/[tT]$/{printf"%u\n", $1*(1000*1000* 1000*1000);next};/[gG]$/{printf"%u\n", $1*(1000*1000*1000);next};/[mM]$/{printf "%u\n", $1*(1000*1000);next};/[kK]$/{printf "%u\n", $1*1000;next};' | feedgnuplot --with "impulse" --title "Best 20 Shares" --set 'logscale y' --terminal 'dumb 25,24' --xmin 1 --xmax 20 --unset ytics --exit
sleep 60
done
#80linegraph.sh - ctrl+c to exit
while true
do
clear
termsize=`stty size | awk '{print $2,$1}'`
tail -n 160 cgminer.log | sed -n 's/.*Accepted.\{10\}Diff \(.*\)\/.*/\1/p' | tail -n 80 | awk '/[0-9]$/{print $1;next};/[pP]$/{printf"%u\n", $1(1000*1000*1000*1000*1000);next};/[tT]$/{printf"%u\n", $1*(1000*1000* 1000*1000);next};/[gG]$/{printf"%u\n", $1*(1000*1000*1000);next};/[mM]$/{printf "%u\n", $1*(1000*1000);next};/[kK]$/{printf "%u\n", $1*1000;next};' | feedgnuplot --lines --title "Last 80 Shares" --set 'logscale y' --terminal 'dumb '"$termsize" --exit
sleep 10
done