summaryrefslogtreecommitdiffstats
path: root/Monitoring/plugins/check_btcguild_miner
diff options
context:
space:
mode:
authormakefu <makefu@syntax-fehler.de>2011-06-30 23:38:47 +0200
committermakefu <makefu@syntax-fehler.de>2011-06-30 23:38:47 +0200
commit1bb3f15231317f3cfd9f6e3d970847f9c288e60a (patch)
treebe18da6f224ab4af4485d21ae2e4a8681c52e817 /Monitoring/plugins/check_btcguild_miner
parent8a19571735f245380ee3cf4d4023a95fa0cdc736 (diff)
merged fixes from testing on monitoring.shack
check_btcguild_miner: tries json and then simplejson to import, fixes try-except block
Diffstat (limited to 'Monitoring/plugins/check_btcguild_miner')
-rwxr-xr-xMonitoring/plugins/check_btcguild_miner12
1 files changed, 9 insertions, 3 deletions
diff --git a/Monitoring/plugins/check_btcguild_miner b/Monitoring/plugins/check_btcguild_miner
index aacdefc9..102e73da 100755
--- a/Monitoring/plugins/check_btcguild_miner
+++ b/Monitoring/plugins/check_btcguild_miner
@@ -1,5 +1,11 @@
-#!/usr/bin/python2
-import json,urllib,datetime,sys
+#!/usr/bin/python
+import urllib,sys
+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"
@@ -11,7 +17,7 @@ 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:
+except:
print "?? cannot parse json or connect to server"
exit (1)