Author

Topic: bcmon: Monitor your ASICMiner Blades and Cubes all at once (linux) (Read 1397 times)

sr. member
Activity: 280
Merit: 250
Helperizer
Very awesome! Have this running on my RPi that's acting as the proxy for my cubes and it's nice to have a simple way to check all of them (especially since I can't access the cubes directly the way the network's laid out)

Very cool!  Glad to see it being useful for more folks!  If you would like any changes, just ask, or if you do any mods, feel free to share.

Best,
- Tye
full member
Activity: 151
Merit: 110
Very awesome! Have this running on my RPi that's acting as the proxy for my cubes and it's nice to have a simple way to check all of them (especially since I can't access the cubes directly the way the network's laid out)
sr. member
Activity: 280
Merit: 250
Helperizer
sr. member
Activity: 280
Merit: 250
Helperizer
NOTE: I'm moving this over to Mining generic forum since there's no software forum for non-miners...

New Version: 2 Jan 2014

I have several blades and cubes and I usually run the stratum_proxy.py from slush so it's hard to monitor them in one place.  So, I wrote a couple of scripts to do the work for me, bcread and bcshow.  I invoke with
Code:
watch -n 10 bcshow
or its "bcmon" alias
Code:
alias bcmon='watch -n 10 bcshow'
and then I get 10-second updates for all blades and cubes in one handy text window.

It occurred to me that I probably wasn't the only one in this situation, so I thought I'd share.  The code is not pretty, but it should work fine under most versions of linux.  The comments indicate where most of the configuration should be done, but feel free to modify to your liking.  Copy these files to your ~/bin directory and chmod +x them and you should be good to go after setting a couple of variables.

Enjoy - hope this is useful to someone!  Tips are welcome but not at all required (BTC: 1GY9wmMmw1E7DPLzQXt4UPuEuHQN29PixD).

Here's a window shot of it in action (nothing fancy but most of the monitoring info is there):


bcread:
Code:
#!/bin/bash

# These scripts assume your blades are between 192.168.1.200 and 192.168.1.210
#       and your cubes are 192.168.1.211 and higher.  If you have a different
#       configuration, please edit the cutoff numbers here:
bladelow=200
bladehigh=210

# Enter your network prefix here.  If your network is 192.168.1.x,
#       then just enter the first 3 portions, as below:
net="192.168.1"

# The web interfaces are standard, i.e. port 8000 for both blades and cubes

if [ "$1" = "" ] ; then exit ; fi

dev="Blade"
spc=""

n=$(($1-$bladelow))

if [ $1 -gt $bladehigh ] ; then
   dev="Cube"
   n=$(echo -n $(($1-$bladehigh))" ")
   spc="   "
fi

if [ $1 -le $bladehigh ] ; then
      t=$(curl -s http://$net.$1:8000 | sed 's/^.*MHS:/MHS:/' | sed 's/s<\/.*/s/' | sed 's/<[^>]*>/ /g' | sed 's/:/: /g' | tr -s " ")
      mp=2 ; jp=4 ; ap=6 ; wup=9 ; ep=11 ; upp=14
else
      t=$(curl -s http://$net.$1:8000 | sed 's/^.*Jobs:/Jobs:/' | sed 's/s<\/.*/s/' | sed 's/<[^>]*>/ /g' | sed 's/:/: /g' | tr -s " ")
      mp=13 ; jp=2 ; ap=4 ; wup=15 ; ep=17 ; upp=20
fi

tmh=$(echo $t | cut -f $mp -d " ")
gh=$(printf "% 6.3f\n" $(echo $tmh/1000 | bc -l))

tjobs=$(echo $t | cut -f $jp -d " " | sed 's/^0*//')

tacc=$(echo $t | cut -f $ap -d " " | sed 's/^0*//')
acc=""$(printf "% 9.0f\n" $tacc)""

let tlost=$tjobs-$tacc
lost=""$(printf "% 9.0f\n" $tlost)""

tutil=$(echo $t | cut -f $wup -d " ")
util=""$(printf "% 3.0f\n" $tutil)""

teff=$(echo $t | cut -f $ep -d " ")
numeff=$(echo $teff | cut -d "%" -f 1)
eff=""$(printf "% 6.2f\n" $numeff)""

tup=$(echo $t | cut -f $upp -d " ")

printf "% -8s" " $dev #$n"
printf "% 3s" "  :"
printf "% 8s" $gh
printf "% 9s" "$eff%"
printf "% 11s" "$util/m  |"
printf "% 12s" $acc
printf "% 10s" $lost
printf "% 17s\n" $tup

bcshow:
Code:
#!/bin/bash

# Enter the last portion of the ip address of each blade and cube, and
#       a "0" indicates you want a line skipped.
ips=(201 203 0 211 212 213 214 215)

let tot=0

echo --------------------------------------------------------------------------------
echo "               GH/s     Eff     Util         Accepts      Lost   Uptime"
echo --------------------------------------------------------------------------------
for ip in ${ips[@]}
do
   if [ "$ip" -gt 0 ] ; then
      . bcread $ip
      let tot="$tot"+"$(echo $tmh|sed 's/^0*//')"
   else
      echo "           :                           |"
   fi
done
echo --------------------------------------------------------------------------------
printf " Total     : %6.3f GH/s" $(echo $tot/1000 | bc -l)
echo
echo
echo
tail -5 ~/.shamine/shalog
echo

Under the hood:  Basically it just scrapes the web interfaces of the blades and cubes and picks out the info I wanted to monitor, then parses it, displays it and does a total hashrate.  Simple and probably not nearly as elegant as it should be, but I'm a quick and dirty "basher" when I can get away with it.  Wink

No doubt these scripts could be easily modified to scrape other miners with web interfaces that don't have APIs, but since I don't have those other miners (and no doubt no-one will donate to me), that is an exercise left to the reader.  Wink
Jump to: