summaryrefslogtreecommitdiffstats
path: root/Monitoring/plugins
diff options
context:
space:
mode:
authormakefu <makefu@syntax-fehler.de>2011-06-30 23:33:03 +0200
committermakefu <makefu@syntax-fehler.de>2011-06-30 23:33:03 +0200
commit8a19571735f245380ee3cf4d4023a95fa0cdc736 (patch)
treeedc0521c4d05fd023859700d7c80339b6498d0b4 /Monitoring/plugins
parent5347a59c010413403eabe9ee584150e96f66623e (diff)
parentf35d129de5003cb46c81a8691ed94285ce467606 (diff)
Merge branch 'master' of github.com:krebscode/painload
Conflicts: mining/Makefile: now installs tmux and configures
Diffstat (limited to 'Monitoring/plugins')
-rwxr-xr-xMonitoring/plugins/check_btcguild_miner27
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)
+