diff options
author | Felix Richter <github@syntax-fehler.de> | 2011-06-30 22:55:26 +0200 |
---|---|---|
committer | Felix Richter <github@syntax-fehler.de> | 2011-06-30 22:55:26 +0200 |
commit | 477793de0c9f448beb0a2c018bb003b5205f97aa (patch) | |
tree | 1ee17508aacfef29848e10e7e62a5dfae8e74dfe | |
parent | fc1e4fcabd1e888089d2ea970ee6906735b84598 (diff) |
added script to check btc guild miner status
seems to be working
-rwxr-xr-x | Monitoring/plugins/btcguild_miner_check | 27 | ||||
-rw-r--r-- | btc/mining/Makefile | 4 |
2 files changed, 29 insertions, 2 deletions
diff --git a/Monitoring/plugins/btcguild_miner_check b/Monitoring/plugins/btcguild_miner_check new file mode 100755 index 00000000..aacdefc9 --- /dev/null +++ b/Monitoring/plugins/btcguild_miner_check @@ -0,0 +1,27 @@ +#!/usr/bin/python2 +import json,urllib,datetime,sys +if len(sys.argv) != 4 : + print "** Usage: %s APIKEY WORKER_NAME LOW_WORKER_SPEED" % sys.argv[0] + print "** aka YOU ARE MADE OF STUPID" + exit (3) + +API_KEY=sys.argv[1] +WORKER_NAME=sys.argv[2] +LOW_WORKER_SPEED=float(sys.argv[3]) +url="http://www.btcguild.com/api.php?api_key=%s" % API_KEY +try: + result = json.load(urllib.urlopen(url)) +except e: + print "?? cannot parse json or connect to server" + exit (1) + +for k,v in result["workers"].iteritems(): + if v["worker_name"] == WORKER_NAME: + curr = v["hash_rate"] + if curr < LOW_WORKER_SPEED: + print "!! %f is below expected %f" (curr,LOW_WORKER_SPEED) + exit (2) + else: + print "++ everything fine, current speed is %f" % curr + exit(0) + diff --git a/btc/mining/Makefile b/btc/mining/Makefile index 0fab7b1f..11058fb1 100644 --- a/btc/mining/Makefile +++ b/btc/mining/Makefile @@ -1,11 +1,11 @@ -.PHONY: all format install +.PHONY: all format install configure select-target: @echo "You are made of stupid!" echo "look here" @cat Makefile format: cat README -install: +install: configure apt-get install --yes lm-sensors echo '#!/bin/bash' > /usr/bin/ati_license echo '#!/bin/sh' > /etc/init.d/live-boot |