Bitcoin Forum
May 04, 2024, 04:04:46 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: bcmon: Monitor your ASICMiner Blades and Cubes all at once (linux)  (Read 1367 times)
twib2 (OP)
Sr. Member
****
Offline Offline

Activity: 280
Merit: 250

Helperizer


View Profile
January 01, 2014, 01:52:43 AM
Last edit: January 17, 2014, 04:39:09 AM by twib2
 #1

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

Cryptsy Exchange        bcmon: Monitor all your miners in one place!            BTC tips: 1GY9wmMmw1E7DPLzQXt4UPuEuHQN29PixD
1714838686
Hero Member
*
Offline Offline

Posts: 1714838686

View Profile Personal Message (Offline)

Ignore
1714838686
Reply with quote  #2

1714838686
Report to moderator
1714838686
Hero Member
*
Offline Offline

Posts: 1714838686

View Profile Personal Message (Offline)

Ignore
1714838686
Reply with quote  #2

1714838686
Report to moderator
1714838686
Hero Member
*
Offline Offline

Posts: 1714838686

View Profile Personal Message (Offline)

Ignore
1714838686
Reply with quote  #2

1714838686
Report to moderator
The trust scores you see are subjective; they will change depending on who you have in your trust list.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714838686
Hero Member
*
Offline Offline

Posts: 1714838686

View Profile Personal Message (Offline)

Ignore
1714838686
Reply with quote  #2

1714838686
Report to moderator
1714838686
Hero Member
*
Offline Offline

Posts: 1714838686

View Profile Personal Message (Offline)

Ignore
1714838686
Reply with quote  #2

1714838686
Report to moderator
twib2 (OP)
Sr. Member
****
Offline Offline

Activity: 280
Merit: 250

Helperizer


View Profile
January 02, 2014, 06:56:18 PM
Last edit: January 02, 2014, 08:22:14 PM by twib2
 #2

Reserved

Cryptsy Exchange        bcmon: Monitor all your miners in one place!            BTC tips: 1GY9wmMmw1E7DPLzQXt4UPuEuHQN29PixD
drmadison
Full Member
***
Offline Offline

Activity: 151
Merit: 110


View Profile
January 03, 2014, 04:10:23 AM
 #3

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)
twib2 (OP)
Sr. Member
****
Offline Offline

Activity: 280
Merit: 250

Helperizer


View Profile
January 03, 2014, 04:37:09 AM
 #4

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

Cryptsy Exchange        bcmon: Monitor all your miners in one place!            BTC tips: 1GY9wmMmw1E7DPLzQXt4UPuEuHQN29PixD
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!