summaryrefslogtreecommitdiffstats
path: root/Monitoring
diff options
context:
space:
mode:
authorFelix Richter <github@syntax-fehler.de>2011-06-30 22:55:26 +0200
committerFelix Richter <github@syntax-fehler.de>2011-06-30 22:55:26 +0200
commitacd206da56f6ebfa123745cf6ab2f429d064363b (patch)
treeac91e41553160705d08f7ffbeec243856d9d8cf4 /Monitoring
parent8f900fff02ac22ba87c35e6745af11c0b8d98855 (diff)
added script to check btc guild miner status
seems to be working
Diffstat (limited to 'Monitoring')
-rwxr-xr-xMonitoring/plugins/btcguild_miner_check27
1 files changed, 27 insertions, 0 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)
+