diff options
author | makefu <github@syntax-fehler.de> | 2011-09-12 14:32:18 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2011-09-12 14:32:18 +0200 |
commit | 9f70f9b5b462aa3e150b9708f695edfaf716edd4 (patch) | |
tree | 5cbebe6cbc0ada2c988d7f14d0bbbc52a68b37c1 /gold | |
parent | 568fbd7fa5541182bbbc33560863ec9c3ff01d48 (diff) | |
parent | a07326f6c57a7e8f49b9bef96ded427275a16e2e (diff) |
Merge branch 'master' into punani_files
Diffstat (limited to 'gold')
36 files changed, 650 insertions, 9 deletions
diff --git a/gold/Makefile b/gold/Makefile index ff553def..97ddcf71 100644 --- a/gold/Makefile +++ b/gold/Makefile @@ -1,3 +1,5 @@ install: ln -snf $$PWD/mtgox/ticker_text.sh ../bin/mtgox_ticker ln -snf $$PWD/scex/ticker_text.sh ../bin/scex_ticker + ln -snf $$PWD/mooncoin/ticker_text.sh ../bin/mooncoin_ticker + ln -snf $$PWD/bitcoinslc/stats_text.sh ../bin/bitcoinslc_stats diff --git a/gold/bitcoinslc/bitcoinslc.stats b/gold/bitcoinslc/bitcoinslc.stats new file mode 100755 index 00000000..8547dbcc --- /dev/null +++ b/gold/bitcoinslc/bitcoinslc.stats @@ -0,0 +1,4 @@ +#! /bin/sh +# get mtgox ticker data +set -euf +curl -ksS https://www.bitcoins.lc/stats.json diff --git a/gold/bitcoinslc/bitcoinslc.stats.render b/gold/bitcoinslc/bitcoinslc.stats.render new file mode 100755 index 00000000..7ab26a02 --- /dev/null +++ b/gold/bitcoinslc/bitcoinslc.stats.render @@ -0,0 +1,7 @@ +#!/usr/bin/python + +import json,sys + +result = json.load(sys.stdin) + +print "Block: " + str(result["current_block"]) + " Difficulty: " + str(result["difficulty"]) diff --git a/gold/bitcoinslc/stats_text.sh b/gold/bitcoinslc/stats_text.sh new file mode 100755 index 00000000..2d146c86 --- /dev/null +++ b/gold/bitcoinslc/stats_text.sh @@ -0,0 +1,4 @@ +#! /bin/sh +set -euf +cd $(dirname `readlink -f $0`) +./bitcoinslc.stats | ./bitcoinslc.stats.render diff --git a/gold/mining/bin/archlinux-cruise-control b/gold/mining/bin/archlinux-cruise-control index de5a0fa4..ba1c35da 100755 --- a/gold/mining/bin/archlinux-cruise-control +++ b/gold/mining/bin/archlinux-cruise-control @@ -4,7 +4,7 @@ export EDITOR=vim echo "!! ARCHLINUX Cruise Control Mining installer !!" echo "** adding main network profile" cp /etc/network.d/examples/ethernet-dhcp /etc/network.d/main -echo 'POST_UP="sed -i \"1i nameserver 8.8.8.8\" /etc/resolv.conf"' >> /etc/network.d/main +echo 'POST_UP="cache=\"\$(cat /etc/resolv.conf)\"; echo \"\$cache\" | sed \"1i nameserver 8.8.8.8\" > /etc/resolv.conf"' >> /etc/network.d/main echo "** adding worker account" grep -q worker /etc/passwd || adduser worker gpasswd -a worker wheel @@ -25,7 +25,9 @@ echo "syntax on" > /home/worker/.vimrc echo "syntax on" > /root/.vimrc echo "** installing tinc" [ "`yaourt -Q tinc`" ] || yaourt -S --noconfirm tinc -sed -i -e 's/.*\%wheel.*/%wheel ALL=(ALL) NOPASSWD: ALL/1' /etc/sudoers +cache="`cat /etc/sudoers`" +echo "$cache" | +sed 's/.*\%wheel.*/%wheel ALL=(ALL) NOPASSWD: ALL/1' > /etc/sudoers echo "** Installing ATI drivers" [ "`yaourt -Q catalyst-utils`" ] || yaourt -S --noconfirm catalyst-utils [ "`yaourt -Q catalyst-hook`" ] || yaourt -S --noconfirm catalyst-hook @@ -33,8 +35,11 @@ echo "** Installing ATI drivers" echo "** installing X" pacman --needed -S --noconfirm xorg-server xorg-apps xorg-appres xorg-xinit xautolock xlockmore xorg-fonts xorg-xhost xorg-xauth xterm rxvt-unicode fluxbox slim echo "** editing slim configuration" -sed -i 's/.*default_user.*/default_user worker/' /etc/slim.conf -sed -i 's/.*auto_login.*/auto_login yes/' /etc/slim.conf +cache="`cat /etc/slim.conf`" +echo "$cache" | sed ' + s/.*default_user.*/default_user worker/ + s/.*auto_login.*/auto_login yes/ +' > /etc/slim.conf echo "** Installing mining tools and overclocking stuff" [ "`yaourt -Q phoenix-miner-svn`" ] || yaourt -S --noconfirm phoenix-miner-svn echo "!! warning, you might need to adjust the version number of AMDOverdriveCTRL !!" diff --git a/gold/mining/bin/cleanup_tmp b/gold/mining/bin/cleanup_tmp index e1395b19..ce72d906 100755 --- a/gold/mining/bin/cleanup_tmp +++ b/gold/mining/bin/cleanup_tmp @@ -1,4 +1,4 @@ #! /bin/sh -ls -lAtr /tmp/ | sed -rn ' - /\.so$/{$!{s/.* ([A-Za-z0-9]+\.so)$/rm -v \/tmp\/\1/p}} +ls -lAtr /tmp/ | sed -n ' + /\.so$/{$!{s/.* \([A-Za-z0-9\]\+\.so\)$/rm -v \/tmp\/\1/p}} ' | sudo sh diff --git a/gold/mining/bin/ensure-wlan0 b/gold/mining/bin/ensure-wlan0 index fa92c4f5..2ede2e8f 100755 --- a/gold/mining/bin/ensure-wlan0 +++ b/gold/mining/bin/ensure-wlan0 @@ -6,10 +6,17 @@ if test "${nosudo-false}" != true -a `id -u` != 0; then exit 23 # go to hell fi +locate_bin() { + type -p "$1" || find / | sed -n '/.*bin\/'"$1"'$/{p;q}' | grep . +} + has_internet() { curl -sS google.com >/dev/null } +wpa_supplicant="`locate_bin wpa_supplicant`" +wpa_cli="`locate_bin wpa_cli`" + if test "${force-false}" = true || ! has_internet; then ## get rid of the fuckers @@ -20,8 +27,8 @@ if test "${force-false}" = true || ! has_internet; then beep -l 50 -f 2000; pkill wpa beep -l 50 -f 2000; rm -vf /var/run/wpa_supplicant/* - beep -l 50 -f 2000; wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf & - while ! wpa_cli status | grep -q wpa_state=COMPLETED; do + beep -l 50 -f 2000; $wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf || $wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf & + while ! $wpa_cli status | grep -q wpa_state=COMPLETED; do beep -l 50 -f 2000 -D 50 -n -l 50 -f 2000 sleep 1 done @@ -38,4 +45,4 @@ else (--quiet) : ;; (*) beep -l 50 -f 2000 -n -l 100 -f 2000 ;; esac -fi +fi 2>&1 | tee /var/log/ensure-wlan0 diff --git a/gold/mooncoin/ticker b/gold/mooncoin/ticker new file mode 100755 index 00000000..1be3ed7f --- /dev/null +++ b/gold/mooncoin/ticker @@ -0,0 +1,2 @@ +#! /bin/sh +exec curl -ksS https://moonco.in/exchange/api/ticker/solidcoin diff --git a/gold/mooncoin/ticker_text.sh b/gold/mooncoin/ticker_text.sh new file mode 100755 index 00000000..fbaff55b --- /dev/null +++ b/gold/mooncoin/ticker_text.sh @@ -0,0 +1,4 @@ +#! /bin/sh +set -euf +cd $(dirname `readlink -f $0`) +./ticker | ../json/render/ticker 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..8e59ab03 --- /dev/null +++ b/gold/scoreboard/README @@ -0,0 +1,29 @@ +Scoreboard +========== +a non-interactive gold logger/plotter + +scoreboard contains a number of modules which do a number of things: +ati_temper: log temperature data of an ati_temper enabled host : + see //gold/miner/bin/ati_temper +solidcoin : graph solidcoin informations +bitcoin : s.a. + +//gold/scoreboard/profile contains all the important paths and variables +which are sourced by the modules. In a new installation this file needs +to be customized. + +//gold/scoreboard/util/schedule_logger is the scheduler for generating +the graphs every 5 minutes. + + +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/.placeholder b/gold/scoreboard/modules/active/.placeholder new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/gold/scoreboard/modules/active/.placeholder 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..af99bfbb --- /dev/null +++ b/gold/scoreboard/modules/available/ati_temper/init @@ -0,0 +1,28 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +MACHINE=chinaman +ln -s $HERE/index $HERE/../../active/${MACHINE}_ati_temper +mkdir -p $PDIR +cat > $PDIR/$MACHINE.conf <<EOF +set terminal png transparent nocrop enhanced font arial 8 size 500 +set xdata time +set autoscale +set grid +set title "$MACHINE Temperature" +set timefmt "%Y-%m-%dT%H:%M:%S" +set format x "%d" +set xlabel "Day" +plot "$ADIR/${MACHINE}_ati_temper" using 1:2 smooth bezier title "gpu0" with lines , \ +"$ADIR/${MACHINE}_ati_temper" using 1:3 smooth bezier title "gpu1" with lines , \ +"$ADIR/${MACHINE}_ati_temper" using 1:4 smooth bezier title "cpu0" with lines , \ +"$ADIR/${MACHINE}_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 \"${MACHINE} 24 hours Temperature\"/" \ + -e "s/${MACHINE}_ati_temper/${MACHINE}_last_day/g" \ + $PDIR/${MACHINE}.conf >$PDIR/${MACHINE}_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..22410f7b --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoin/gather @@ -0,0 +1,13 @@ +#!/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/bitcoinslc_stats` | sed -e 's/Difficulty: //' -e 's/Block: //' | 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..97b60402 --- /dev/null +++ b/gold/scoreboard/modules/available/bitcoin/init @@ -0,0 +1,48 @@ +#!/bin/sh +#set -x +HERE=$(dirname $(readlink -f $0)) +. $HERE/../../../profile +mkdir -p $PDIR +ln -s $HERE/index $HERE/../../active/bitcoin +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 "High" with lines , \ + "$ADIR/ticker_bitcoin" using 1:3 smooth bezier title "Low" with lines , \ + "$ADIR/ticker_bitcoin" using 1:4 smooth bezier title "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..7ef432ac --- /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 |