From 477793de0c9f448beb0a2c018bb003b5205f97aa Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Thu, 30 Jun 2011 22:55:26 +0200 Subject: added script to check btc guild miner status seems to be working --- Monitoring/plugins/btcguild_miner_check | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 Monitoring/plugins/btcguild_miner_check (limited to 'Monitoring') 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) + -- cgit v1.2.3 From 3aa54ea3040e2a52099f8496ab255982caa88f51 Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Thu, 30 Jun 2011 23:04:35 +0200 Subject: renamed btcguild script, added command to Monitoring shack_guest now contains the command to check chinaman --- Monitoring/conf/shack_guests.cfg | 13 +++++++++++++ Monitoring/plugins/btcguild_miner_check | 27 --------------------------- Monitoring/plugins/check_btcguild_miner | 27 +++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 27 deletions(-) delete mode 100755 Monitoring/plugins/btcguild_miner_check create mode 100755 Monitoring/plugins/check_btcguild_miner (limited to 'Monitoring') diff --git a/Monitoring/conf/shack_guests.cfg b/Monitoring/conf/shack_guests.cfg index 45617461..79796541 100644 --- a/Monitoring/conf/shack_guests.cfg +++ b/Monitoring/conf/shack_guests.cfg @@ -26,6 +26,7 @@ define host{ hostgroups bitcoin-miner } +#Chinaman define host{ use generic-host host_name chinaman @@ -36,6 +37,18 @@ define host{ hostgroups bitcoin-miner,tinc-nodes,ssh-servers contact_groups krebsminers } +define service { + host_name chinaman + service_description BTCGUILD hash rate checker + use generic-service + check_command check_btcguild_miner!4bf1543d2eca8648277bdc66c326eea9!txgen_chinaman!600 + contact_groups krebsminers + } + +define command { + command_name check_btcguild_miner + command_line $USER1$/check_btcguild_miner $ARG1$ $ARG2$ $ARG3$ + } define host{ use generic-host diff --git a/Monitoring/plugins/btcguild_miner_check b/Monitoring/plugins/btcguild_miner_check deleted file mode 100755 index aacdefc9..00000000 --- a/Monitoring/plugins/btcguild_miner_check +++ /dev/null @@ -1,27 +0,0 @@ -#!/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/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) + -- cgit v1.2.3