diff options
Diffstat (limited to 'gold/scoreboard')
29 files changed, 589 insertions, 0 deletions
diff --git a/gold/scoreboard/.gitignore b/gold/scoreboard/.gitignore new file mode 100644 index 00000000..657e895d --- /dev/null +++ b/gold/scoreboard/.gitignore @@ -0,0 +1,3 @@ +/plot/ +/profile +/archive/ diff --git a/gold/scoreboard/README b/gold/scoreboard/README new file mode 100644 index 00000000..180cbd0d --- /dev/null +++ b/gold/scoreboard/README @@ -0,0 +1,15 @@ +Scoreboard +========== +a non-interactive gold logger/plotter + +Install +====== +* install lighttpd +* configure the profile template file accordingly +* [currently] do: + cd modules/available/ ati_temper; $EDITOR gather # change the host + * add the host key file to keys/ +* [currently] run: + modules/available/{ati_temper,bitcoin,solidcoin,static}/init +* run: + util/schedule_logger diff --git a/gold/scoreboard/modules/active/bitcoin b/gold/scoreboard/modules/active/bitcoin new file mode 120000 index 00000000..86564edb --- /dev/null +++ b/gold/scoreboard/modules/active/bitcoin @@ -0,0 +1 @@ +/root/btc_logger/modules/available/bitcoin/index
\ No newline at end of file diff --git a/gold/scoreboard/modules/active/chinaman_temper b/gold/scoreboard/modules/active/chinaman_temper new file mode 120000 index 00000000..31935833 --- /dev/null +++ b/gold/scoreboard/modules/active/chinaman_temper @@ -0,0 +1 @@ +/root/btc_logger/modules/available/ati_temper/index
\ No newline at end of file diff --git a/gold/scoreboard/modules/active/solidcoin b/gold/scoreboard/modules/active/solidcoin new file mode 120000 index 00000000..0062d804 --- /dev/null +++ b/gold/scoreboard/modules/active/solidcoin @@ -0,0 +1 @@ +/root/btc_logger/modules/available/solidcoin/index
\ No newline at end of file diff --git a/gold/scoreboard/modules/available/ati_temper/gather b/gold/scoreboard/modules/available/ati_temper/gather new file mode 100755 index 00000000..15f0b4f2 --- /dev/null +++ b/gold/scoreboard/modules/available/ati_temper/gather @@ -0,0 +1,14 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile + +# machine to check for +MACHINE=chinaman +MACHINE_KEY=$MDIR/keys/$MACHINE +LF=${MACHINE}_ati_temper +mkdir -p $ADIR +mkdir -p $LDIR + +# write into live directory and archive +[ ! -e $MACHINE_KEY ] && echo "No Key for $MACHINE" && exit 1 +echo "$(date +%Y-%m-%dT%H:%M:%S) $(ssh -i $MACHINE_KEY worker@$MACHINE '~/bin/ati_temper')" | tee $LDIR/$LF >> $ADIR/$LF diff --git a/gold/scoreboard/modules/available/ati_temper/index b/gold/scoreboard/modules/available/ati_temper/index new file mode 100755 index 00000000..19c21825 --- /dev/null +++ b/gold/scoreboard/modules/available/ati_temper/index @@ -0,0 +1,4 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +$HERE/gather +$HERE/plot diff --git a/gold/scoreboard/modules/available/ati_temper/init b/gold/scoreboard/modules/available/ati_temper/init new file mode 100755 index 00000000..88a0ed10 --- /dev/null +++ b/gold/scoreboard/modules/available/ati_temper/init @@ -0,0 +1,25 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +mkdir -p $PDIR +cat > $PDIR/chinaman.conf <<EOF +set terminal png transparent nocrop enhanced font arial 8 size 500 +set xdata time +set autoscale +set grid +set title "Chinaman Temperature" +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +set xlabel "Day" +plot "$ADIR/chinaman_ati_temper" using 1:2 smooth bezier title "gpu0" with lines , \ +"$ADIR/chinaman_ati_temper" using 1:3 smooth bezier title "gpu1" with lines , \ +"$ADIR/chinaman_ati_temper" using 1:4 smooth bezier title "cpu0" with lines , \ +"$ADIR/chinaman_ati_temper" using 1:5 smooth bezier title "rack" with lines +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/set title.*/set title "Chinaman 24 hours Temperature"/' \ + -e "s/chinaman_ati_temper/chinaman_last_day/g" \ + $PDIR/chinaman.conf >$PDIR/chinaman_last_day.conf diff --git a/gold/scoreboard/modules/available/ati_temper/plot b/gold/scoreboard/modules/available/ati_temper/plot new file mode 100755 index 00000000..06f20c24 --- /dev/null +++ b/gold/scoreboard/modules/available/ati_temper/plot @@ -0,0 +1,10 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +umask 000 +export GDFONTPATH=/usr/share/fonts/truetype/msttcorefonts +mkdir -p $GDIR +gnuplot $PDIR/chinaman.conf> $GDIR/chinaman_overall.png +tail -n288 $ADIR/chinaman_ati_temper > $ADIR/chinaman_last_day +gnuplot $PDIR/chinaman_last_day.conf > $GDIR/chinaman_24h.png diff --git a/gold/scoreboard/modules/available/bitcoin/gather b/gold/scoreboard/modules/available/bitcoin/gather new file mode 100755 index 00000000..8b996428 --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoin/gather @@ -0,0 +1,12 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +LF=bitcoin +mkdir -p $ADIR +mkdir -p $LDIR + + +# write into live directory and archive +$BITCOIND_PATH getinfo | python $HERE/render | tee $LDIR/$LF >> $ADIR/$LF + +echo `date +"%Y-%m-%dT%H:%M:%S"` `$KREBSDIR/bin/mtgox_ticker` | sed -e 's/High: //' -e 's/Low: //' -e 's/Last: //' | tee $LDIR/ticker_${LF}>> $ADIR/ticker_${LF} diff --git a/gold/scoreboard/modules/available/bitcoin/index b/gold/scoreboard/modules/available/bitcoin/index new file mode 100755 index 00000000..19c21825 --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoin/index @@ -0,0 +1,4 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +$HERE/gather +$HERE/plot diff --git a/gold/scoreboard/modules/available/bitcoin/init b/gold/scoreboard/modules/available/bitcoin/init new file mode 100755 index 00000000..c4ddf32f --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoin/init @@ -0,0 +1,47 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +mkdir -p $PDIR +cat > $PDIR/bitcoin.conf <<EOF +set terminal png transparent nocrop enhanced font arial 8 size 500 #size 640, 240 +set style function lines +#set size ratio 0.5 +#set origin 0.0,0.5 +set multiplot title "Bitcoin" +set grid +unset key + +set autoscale +set xdata time +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +#set xlabel "Day" + +set title "Blocks" +set size 0.5,0.5 +set origin 0.0,0.0 +plot "$ADIR/bitcoin" using 1:2 smooth bezier title "Blocks" with lines + +set title "Difficulty" +set size 0.5,0.5 +set origin 0.5,0.0 +plot "$ADIR/bitcoin" using 1:3 title "Difficulty" with lines + +#set title "MtGox Pricing" +set notitle +set tmargin 2 +set size 1,0.5 +set origin 0.0,0.5 +set key left top +plot "$ADIR/ticker_bitcoin" using 1:2 smooth bezier title "Scex High" with lines , \ + "$ADIR/ticker_bitcoin" using 1:3 smooth bezier title "Scex Low" with lines , \ + "$ADIR/ticker_bitcoin" using 1:4 smooth bezier title "Scex Last" with lines + +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/title \"Bitcoin\"/title "Bitcoin Last Day"/' \ + -e "s/bitcoin/bitcoin_last_day/g" \ + $PDIR/bitcoin.conf >$PDIR/bitcoin_last_day.conf diff --git a/gold/scoreboard/modules/available/bitcoin/plot b/gold/scoreboard/modules/available/bitcoin/plot new file mode 100755 index 00000000..209f662c --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoin/plot @@ -0,0 +1,11 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +umask 000 +export GDFONTPATH=/usr/share/fonts/truetype/msttcorefonts +mkdir -p $GDIR +gnuplot $PDIR/bitcoin.conf> $GDIR/bitcoin.png +tail -n288 $ADIR/bitcoin > $ADIR/bitcoin_last_day +tail -n288 $ADIR/ticker_bitcoin > $ADIR/ticker_bitcoin_last_day +gnuplot $PDIR/bitcoin_last_day.conf > $GDIR/bitcoin_24h.png diff --git a/gold/scoreboard/modules/available/bitcoin/render b/gold/scoreboard/modules/available/bitcoin/render new file mode 100644 index 00000000..19545b21 --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoin/render @@ -0,0 +1,10 @@ +#!/usr/bin/python +import json,urllib,datetime,sys +today = datetime.datetime.now() + +result = json.load(sys.stdin) +print today.strftime("%Y-%m-%dT%H:%M:%S"), +print '%s' % result["blocks"], +print '%s' % result["difficulty"], +print '%s' % result["keypoololdest"], +print '%s' % result["keypoolsize"] diff --git a/gold/scoreboard/modules/available/bitcoinpool/bitcoinpool_stats b/gold/scoreboard/modules/available/bitcoinpool/bitcoinpool_stats new file mode 100755 index 00000000..599ef9ff --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoinpool/bitcoinpool_stats @@ -0,0 +1,11 @@ +#!/usr/bin/python2 +import simplejson,urllib,datetime +url="http://bitcoinpool.com/pooljson.php" +f = open('/home/makefu/log/bitcoinpool_stats',mode='a') +today = datetime.datetime.now() + +result = simplejson.load(urllib.urlopen(url)) +print >>f, today.strftime("%Y-%m-%dT%H:%M:%S"), +for k,v in result.iteritems(): + print >>f ,'%s' % v, +print >>f diff --git a/gold/scoreboard/modules/available/bitcoinslc/bitcoinslc_live b/gold/scoreboard/modules/available/bitcoinslc/bitcoinslc_live new file mode 100755 index 00000000..9fcbc6af --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoinslc/bitcoinslc_live @@ -0,0 +1,8 @@ +#!/bin/sh +LF=`basename $0` +token=`curl -A 'Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0' http://www.bitcoins.lc -c cookiejar 2>/dev/null | grep -E '_csrf_token' | tail -n 1 | sed -n 's/.*value="\([0-9a-f]*\)".*/\1/p'` + +curl --keepalive -v -A 'Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0' -e http://www.bitcoins.lc/ -d "_csrf_token=$token" -d "action=login" -d "email=$BITCOINSLC_MAIL" -d "password=$BITCOINSLC_PASS" -d "login=Proceed" -b cookiejar -c cookiejar https://www.bitcoins.lc/ -k 2>/dev/null +#<p><p><strong>Your current total hashrate</strong><br>765.94 Mhash/s</p></p> +mkdir -p $LDIR +echo $(date +%Y-%m-%dT%H:%M:%S) `curl -b cookiejar -A 'Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0' https://www.bitcoins.lc/stats --keepalive 2>/dev/null| sed -n 's/.*Your current total hashrate<\/strong><br>\([0-9.]*\).*/\1/p'` > $ADIR/chinaman_$LF diff --git a/gold/scoreboard/modules/available/bitcoinslc/bitcoinslc_stats b/gold/scoreboard/modules/available/bitcoinslc/bitcoinslc_stats new file mode 100755 index 00000000..29508486 --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoinslc/bitcoinslc_stats @@ -0,0 +1,18 @@ +#!/usr/bin/python2 +import simplejson,urllib,datetime,sys +url="https://www.bitcoins.lc/stats.json" +f = open(sys.env['ADIR']+'/bitcoinslc_stats',mode='a') +today = datetime.datetime.now() + +result = simplejson.load(urllib.urlopen(url)) +print >>f, today.strftime("%Y-%m-%dT%H:%M:%S"), +# hash_rate current_block active_workers total_workers total_users round_shares valid_round_shares total_shares +print >>f , ("%s" % result['hash_rate'] ), +print >>f , ("%s" % result['current_block'] ), +print >>f , ("%s" % result['active_workers'] ), +print >>f , ("%s" % result['total_workers'] ), +print >>f , ("%s" % result['total_users'] ), +print >>f , ("%s" % result['round_shares'] ), +print >>f , ("%s" % result['valid_round_shares'] ), +print >>f , ("%s" % result['total_shares'] ), +print >>f diff --git a/gold/scoreboard/modules/available/btcguild/btcguild_stats b/gold/scoreboard/modules/available/btcguild/btcguild_stats new file mode 100755 index 00000000..58d72f75 --- /dev/null +++ b/gold/scoreboard/modules/available/btcguild/btcguild_stats @@ -0,0 +1,22 @@ +#!/usr/bin/python2 +import simplejson,urllib,datetime +url="http://www.btcguild.com/pool_stats.php" +f = open('/home/makefu/log/btcguild_stats',mode='a') +today = datetime.datetime.now() + +result = simplejson.load(urllib.urlopen(url)) +try: + print >>f, today.strftime("%Y-%m-%dT%H:%M:%S"), + # uk_speed round_time round_shares active_workers useast_speed uscentral_speed uswest_speed hash_rate nl_speed + print >>f , ("%s" % '0' ).replace('.',''), + print >>f , ("%s" % result['round_time'] ).replace('.',''), + print >>f , ("%s" % result['round_shares'] ).replace('.',''), + print >>f , ("%s" % result['active_workers'] ).replace('.',''), + print >>f , ("%s" % result['useast_speed'] ).replace('.',''), + print >>f , ("%s" % result['uscentral_speed'] ).replace('.',''), + print >>f , ("%s" % result['uswest_speed'] ).replace('.',''), + print >>f , ("%s" % result['hash_rate'] ).replace('.',''), + print >>f , ("%s" % 0 ).replace('.',''), + print >>f +except: + pass diff --git a/gold/scoreboard/modules/available/btcguild/btcguild_stats_self b/gold/scoreboard/modules/available/btcguild/btcguild_stats_self new file mode 100755 index 00000000..9cb65590 --- /dev/null +++ b/gold/scoreboard/modules/available/btcguild/btcguild_stats_self @@ -0,0 +1,15 @@ +#!/usr/bin/python2 +import simplejson,urllib,datetime,sys +url="http://www.btcguild.com/api.php?api_key="+sys.env['BTCGUILD_APIKEY'] +f = open('/home/makefu/log/btcguild_stats_self',mode='a') +today = datetime.datetime.now() + +#result = simplejson.load(urllib.urlopen(url)) +#print >>f, today.strftime("%Y-%m-%dT%H:%M:%S"), + +# TODO do the right thing with the data (aka this loop is wrong, fixme +#for k,v in result.iteritems(): +# data = '%s' % v +# data = data.replace('.','') +# print >>f ,data, +#print >>f diff --git a/gold/scoreboard/modules/available/create_gnuplot b/gold/scoreboard/modules/available/create_gnuplot new file mode 100755 index 00000000..95a6d170 --- /dev/null +++ b/gold/scoreboard/modules/available/create_gnuplot @@ -0,0 +1,196 @@ +#!/bin/sh +#set -x +umask 000 +MDIR=/home/makefu/log +DDIR=/srv/http/tmp +mkdir -p $DDIR/graphs +cat > $DDIR/.htaccess << EOF +order allow,deny +allow from all +EOF + +# +# chinaman +# +cat > $MDIR/plot/chinaman.conf <<EOF +set terminal png transparent nocrop enhanced font arial 8 +set xdata time +set autoscale +set grid +set title "Chinaman Temperature" +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +set xlabel "Day" +plot "$MDIR/chinaman_ati_temper" using 1:2 smooth bezier title "gpu0" with lines , \ +"$MDIR/chinaman_ati_temper" using 1:3 smooth bezier title "gpu1" with lines , \ +"$MDIR/chinaman_ati_temper" using 1:4 smooth bezier title "cpu0" with lines , \ +"$MDIR/chinaman_ati_temper" using 1:5 smooth bezier title "rack" with lines +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/set title.*/set title "Chinaman 24 hours Temperature"/' \ + -e 's/chinaman_ati_temper/chinaman_last_day/g' \ + $MDIR/plot/chinaman.conf >$MDIR/plot/chinaman_last_day.conf + +cat $MDIR/plot/chinaman.conf | gnuplot > $DDIR/graphs/chinaman_overall.png +tail -n288 $MDIR/chinaman_ati_temper > $MDIR/chinaman_last_day +cat $MDIR/plot/chinaman_last_day.conf | gnuplot > $DDIR/graphs/chinaman_24h.png +rm $MDIR/chinaman_last_day + +# +#bitcoinpool +# +cat > $MDIR/plot/bitcoinpool.conf <<EOF +set terminal png +set size 1.0, 1.0 +set style function lines +set origin 0.0, 0.0 + +set multiplot +set grid +unset key + +set autoscale +set xdata time +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +#set xlabel "Day" + +set title "Efficieny" +set size 0.5,0.5 +set origin 0.0,0.5 +plot "$MDIR/bitcoinpool_stats" using 1:2 smooth bezier title "Efficieny" with lines + +set title "round shares" +set size 0.5,0.5 +set origin 0.0,0.0 +plot "$MDIR/bitcoinpool_stats" using 1:3 smooth bezier title "round shares" with lines + + +set title "Active Users" +set size 0.5,0.5 +set origin 0.5,0.0 +plot "$MDIR/bitcoinpool_stats" using 1:5 smooth bezier title "active users" with lines +set title "Hashrate" +set size 0.5,0.5 +set origin 0.5,0.5 +plot "$MDIR/bitcoinpool_stats" using 1:7 smooth bezier title "hashrate" with lines +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/bitcoinpool_stats/bitcoinpool_last_day/g' \ + $MDIR/plot/bitcoinpool.conf >$MDIR/plot/bitcoinpool_last_day.conf + +cat $MDIR/plot/bitcoinpool.conf | gnuplot > $DDIR/graphs/bitcoinpool.png +tail -n288 $MDIR/bitcoinpool_stats > $MDIR/bitcoinpool_last_day +cat $MDIR/plot/bitcoinpool_last_day.conf | gnuplot > $DDIR/graphs/bitcoinpool_24h.png +rm $MDIR/bitcoinpool_last_day + +# uk_speed round_time round_shares active_workers useast_speed uscentral_speed uswest_speed hash_rate nl_speed +cat > $MDIR/plot/btcguild.conf <<EOF +set terminal png +set size 1.0, 1.0 +set style function lines +set origin 0.0, 0.0 + +set multiplot +set grid +unset key + +set autoscale +set xdata time +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +#set xlabel "Day" + + +set title "round shares" +set size 0.5,0.5 +set origin 0.0,0.0 +set yrange [0:3000000] +plot "$MDIR/btcguild_stats" using 1:4 smooth bezier title "round shares" with lines + + +set title "Active Users" +set size 0.5,0.5 +set origin 0.5,0.0 +set autoscale +plot "$MDIR/btcguild_stats" using 1:5 smooth bezier title "active users" with lines + +set title "Hashrate" +set size 0.5,0.5 +set origin 0.5,0.5 +plot "$MDIR/btcguild_stats" using 1:9 smooth bezier title "hashrate" with lines + +set title "Hash count" +set size 0.5,0.5 +set origin 0.0,0.5 +bw=300000 +set autoscale +bin(x,width)=width*floor(x/width) +#plot "$MDIR/btcguild_stats" using (bin(\$4,bw)):(1.0) smooth frequency title "time taken" with steps + +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/btcguild_stats/btcguild_last_day/g' \ + $MDIR/plot/btcguild.conf >$MDIR/plot/btcguild_last_day.conf + +gnuplot $MDIR/plot/btcguild.conf > $DDIR/graphs/btcguild.png +tail -n288 $MDIR/btcguild_stats > $MDIR/btcguild_last_day +gnuplot $MDIR/plot/btcguild_last_day.conf > $DDIR/graphs/btcguild_24h.png +rm $MDIR/btcguild_last_day + +# +#bitcoinslc +# +cat > $MDIR/plot/bitcoinslc.conf <<EOF +set terminal png +set size 1.0, 1.0 +set style function lines +set origin 0.0, 0.0 + +set multiplot +set grid +unset key + +set autoscale +set xdata time +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +#set xlabel "Day" +# hash_rate current_block active_workers total_workers total_users round_shares valid_round_shares total_shares + +set title "Hash Rate" +set size 0.5,0.5 +set origin 0.0,0.5 +plot "$MDIR/bitcoinslc_stats" using 1:2 smooth bezier title "Hash Rate" with lines + +set title "active workers" +set size 0.5,0.5 +set origin 0.0,0.0 +plot "$MDIR/bitcoinslc_stats" using 1:4 smooth bezier title "workers" with lines + + +set title "Round Shares" +set size 0.5,0.5 +set origin 0.5,0.0 +plot "$MDIR/bitcoinslc_stats" using 1:7 smooth bezier title "round shares" with lines +set title "Total Shares" +set size 0.5,0.5 +set origin 0.5,0.5 +plot "$MDIR/bitcoinslc_stats" using 1:7 smooth bezier title "shares" with lines +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/bitcoinslc_stats/bitcoinslc_last_day/g' \ + $MDIR/plot/bitcoinslc.conf >$MDIR/plot/bitcoinslc_last_day.conf + +cat $MDIR/plot/bitcoinslc.conf | gnuplot > $DDIR/graphs/bitcoinslc.png +tail -n288 $MDIR/bitcoinslc_stats > $MDIR/bitcoinslc_last_day +cat $MDIR/plot/bitcoinslc_last_day.conf | gnuplot > $DDIR/graphs/bitcoinslc_24h.png +rm $MDIR/bitcoinslc_last_day diff --git a/gold/scoreboard/modules/available/solidcoin/gather b/gold/scoreboard/modules/available/solidcoin/gather new file mode 100755 index 00000000..b4fe81f2 --- /dev/null +++ b/gold/scoreboard/modules/available/solidcoin/gather @@ -0,0 +1,12 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +LF=solidcoin +mkdir -p $ADIR +mkdir -p $LDIR + + +# write into live directory and archive +$SOLIDCOIND_PATH sc_getinfo | python $HERE/render | tee $LDIR/$LF >> $ADIR/$LF + +echo `date +"%Y-%m-%dT%H:%M:%S"` `$KREBSDIR/bin/scex_ticker` | sed -e 's/High: //' -e 's/Low: //' -e 's/Last: //' | tee $LDIR/ticker_${LF}>> $ADIR/ticker_${LF} diff --git a/gold/scoreboard/modules/available/solidcoin/index b/gold/scoreboard/modules/available/solidcoin/index new file mode 100755 index 00000000..19c21825 --- /dev/null +++ b/gold/scoreboard/modules/available/solidcoin/index @@ -0,0 +1,4 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +$HERE/gather +$HERE/plot diff --git a/gold/scoreboard/modules/available/solidcoin/init b/gold/scoreboard/modules/available/solidcoin/init new file mode 100755 index 00000000..c12a6586 --- /dev/null +++ b/gold/scoreboard/modules/available/solidcoin/init @@ -0,0 +1,47 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +mkdir -p $PDIR +cat > $PDIR/solidcoin.conf <<EOF +set terminal png transparent nocrop enhanced font arial 8 size 500 #size 640, 240 +set style function lines +#set size ratio 0.5 +#set origin 0.0,0.5 +set multiplot title "Solidcoin" +set grid +unset key + +set autoscale +set xdata time +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +#set xlabel "Day" + +set title "Blocks" +set size 0.5,0.5 +set origin 0.0,0.0 +plot "$ADIR/solidcoin" using 1:2 smooth bezier title "Blocks" with lines + +set title "Difficulty" +set size 0.5,0.5 +set origin 0.5,0.0 +plot "$ADIR/solidcoin" using 1:3 title "Difficulty" with lines + +#set title "Scex Pricing" +set notitle +set tmargin 2 +set size 1,0.5 +set origin 0.0,0.5 +set key left top +plot "$ADIR/ticker_solidcoin" using 1:2 smooth bezier title "Scex High" with lines , \ + "$ADIR/ticker_solidcoin" using 1:3 smooth bezier title "Scex Low" with lines , \ + "$ADIR/ticker_solidcoin" using 1:4 smooth bezier title "Scex Last" with lines + +EOF + +sed -e 's/set xlabel.*/set xlabel "Time of Day"/' \ + -e 's/set format.*/set format x "%H"/' \ + -e 's/title \"Solidcoin\"/title "Solidcoin Last Day"/' \ + -e "s/solidcoin/solidcoin_last_day/g" \ + $PDIR/solidcoin.conf >$PDIR/solidcoin_last_day.conf diff --git a/gold/scoreboard/modules/available/solidcoin/plot b/gold/scoreboard/modules/available/solidcoin/plot new file mode 100755 index 00000000..d1feae88 --- /dev/null +++ b/gold/scoreboard/modules/available/solidcoin/plot @@ -0,0 +1,11 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +umask 000 +export GDFONTPATH=/usr/share/fonts/truetype/msttcorefonts +mkdir -p $GDIR +gnuplot $PDIR/solidcoin.conf> $GDIR/solidcoin.png +tail -n288 $ADIR/solidcoin > $ADIR/solidcoin_last_day +tail -n288 $ADIR/ticker_solidcoin > $ADIR/ticker_solidcoin_last_day +gnuplot $PDIR/solidcoin_last_day.conf > $GDIR/solidcoin_24h.png diff --git a/gold/scoreboard/modules/available/solidcoin/render b/gold/scoreboard/modules/available/solidcoin/render new file mode 100644 index 00000000..19545b21 --- /dev/null +++ b/gold/scoreboard/modules/available/solidcoin/render @@ -0,0 +1,10 @@ +#!/usr/bin/python +import json,urllib,datetime,sys +today = datetime.datetime.now() + +result = json.load(sys.stdin) +print today.strftime("%Y-%m-%dT%H:%M:%S"), +print '%s' % result["blocks"], +print '%s' % result["difficulty"], +print '%s' % result["keypoololdest"], +print '%s' % result["keypoolsize"] diff --git a/gold/scoreboard/modules/available/static/init b/gold/scoreboard/modules/available/static/init new file mode 100755 index 00000000..a7dc8859 --- /dev/null +++ b/gold/scoreboard/modules/available/static/init @@ -0,0 +1,32 @@ +#!/bin/sh +# TODO use active modules to find out which to build +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +cat <<EOF >$GDIR/index.html +<html> + <head> + <title>Stats</title> + </head> + <body> + <center> + <div style="background-color: lightgrey;"> + <b><a href=http://bitcoin.sipa.be/index.html>Hashrate stats</a> + <a href=http://bitcoinx.com/profit/index.php>Mining Calculator</a> + </b> + </div> + <h1>Chinaman</h1> + <img src="chinaman_overall.png"> <img src="chinaman_24h.png"><br/> + <h1>Solidcoin</h1> + <img src="solidcoin.png"> <img src="solidcoin_24h.png"><br/> + <h1>Bitcoin</h1> + <img src="bitcoin.png"> <img src="bitcoin_24h.png"><br/> + <!--<h1>BTCGuild</h1> + <img src="btcguild.png"> <img src="btcguild_24h.png"><br/> + <h1>Bitcoinpool</h1> + <img src="bitcoinpool.png"> <img src="bitcoinpool_24h.png"><br/> + <h1>Bitcoins.lc</h1> + <img src="bitcoinslc.png"> <img src="bitcoinslc_24h.png"><br/> --!> + </center> + </body> +</html> +EOF diff --git a/gold/scoreboard/profile b/gold/scoreboard/profile new file mode 100644 index 00000000..ccd7c2b5 --- /dev/null +++ b/gold/scoreboard/profile @@ -0,0 +1,26 @@ +# the webpage directory +WDIR=/srv/http/tmp +LDIR=$WDIR/live +GDIR=$WDIR/graphs/gold + +# the root directory +KREBSDIR=/krebs +MDIR=$KREBSDIR/gold/scoreboard + +# folder where plot configs are written into +PDIR=$MDIR/plot +# the archive directory +ADIR=$MDIR/archive + +TEMPDIR=/tmp + +# bitcoinslc login/password +BITCOINSLC_MAIL= +BITCOINSLC_PASS= + +# binaries +SOLIDCOIND_PATH=/root/bin/solidcoind +BITCOIND_PATH=/root/bin/bitcoind + +# BTCGUILD +BTCGUILD_APIKEY= diff --git a/gold/scoreboard/util/run-folder b/gold/scoreboard/util/run-folder new file mode 100755 index 00000000..ae5c96ac --- /dev/null +++ b/gold/scoreboard/util/run-folder @@ -0,0 +1,6 @@ +#!/bin/sh +ls -1 $1 | while read script; do + echo "Running $script" + $1/$script & +done + diff --git a/gold/scoreboard/util/schedule_logger b/gold/scoreboard/util/schedule_logger new file mode 100755 index 00000000..6d071ba9 --- /dev/null +++ b/gold/scoreboard/util/schedule_logger @@ -0,0 +1,13 @@ +#!/bin/sh +HERE=$(dirname $(readlink -f $0)) +. $HERE/../profile +RUN_PARTS=$HERE/run-folder +echo "adding getlogs to crontab" + +crontab -l 2>/dev/null | grep -v "$MDIR/modules/active" > $TEMPDIR/currcron +echo "*/5 * * * * /bin/date >>$TEMPDIR/debug_log && $RUN_PARTS $MDIR/modules/active >>$TEMPDIR/btc_logger_debug_log 2>&1" >> $TEMPDIR/currcron + +cat $TEMPDIR/currcron + +crontab $TEMPDIR/currcron +rm $TEMPDIR/currcron |