summaryrefslogtreecommitdiffstats
path: root/god/Monitoring/nagios/plugins/check_btcguild_miner
diff options
context:
space:
mode:
authoreuer <root@euer.krebsco.de>2012-12-23 00:21:25 +0100
committereuer <root@euer.krebsco.de>2012-12-23 00:21:25 +0100
commit9456cfffea015812acf5dcdd2d074e98ca54e720 (patch)
treee57111b7d1499bb6f1ef49937f5f62de158ae5db /god/Monitoring/nagios/plugins/check_btcguild_miner
parent3649aff46c8bace238c3cf22abcfbfe8be9dce8a (diff)
//Monitoring -> //god/Monitoring
Diffstat (limited to 'god/Monitoring/nagios/plugins/check_btcguild_miner')
-rwxr-xr-xgod/Monitoring/nagios/plugins/check_btcguild_miner36
1 files changed, 36 insertions, 0 deletions
diff --git a/god/Monitoring/nagios/plugins/check_btcguild_miner b/god/Monitoring/nagios/plugins/check_btcguild_miner
new file mode 100755
index 00000000..2e6a8de3
--- /dev/null
+++ b/god/Monitoring/nagios/plugins/check_btcguild_miner
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+
+import sys
+from urllib2 import urlopen
+try:
+ import json
+ getattr(json,"load")
+except: #deal with it
+ import simplejson as json
+
+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:
+ fh = urlopen(url)
+ result = json.load(fh)
+except Exception,e:
+ print "?? cannot parse json or connect to server: %s"% str(e)
+ 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)
+