diff options
author | Felix Richter <github@syntax-fehler.de> | 2011-06-30 23:04:35 +0200 |
---|---|---|
committer | Felix Richter <github@syntax-fehler.de> | 2011-06-30 23:05:41 +0200 |
commit | 9dd15654794ff3b046be4389fbd047b42500ef67 (patch) | |
tree | 5a26de1cdf0dd5d89bab8a8a49c18cf1621b7b46 /Monitoring/plugins/check_btcguild_miner | |
parent | 01f35f62d2efe5fc8c41e7964f60c0a2d96f9c71 (diff) |
renamed btcguild script, added command to Monitoring
shack_guest now contains the command to check chinaman
Diffstat (limited to 'Monitoring/plugins/check_btcguild_miner')
-rwxr-xr-x | Monitoring/plugins/check_btcguild_miner | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Monitoring/plugins/check_btcguild_miner b/Monitoring/plugins/check_btcguild_miner new file mode 100755 index 00000000..aacdefc9 --- /dev/null +++ b/Monitoring/plugins/check_btcguild_miner @@ -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) + |