2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

set U as default

This commit is contained in:
Nils 2018-03-30 14:16:57 +02:00
parent 8a72386a30
commit 6ff34af50e

View File

@ -85,22 +85,21 @@ except IOError as exc:
# manage codec and error handling lookup process
reader = codecs.getreader("utf-8")
hash_rate = "U"
try:
mining_stats = json.load(reader(mining_stats_raw))
except ValueError:
print("Failed to parse JSON responce.", file=sys.stderr)
print("flypool_hs_{}_{}.value U".format(zcash_address, miner))
else:
try:
worker = mining_stats['data']
except (KeyError, TypeError):
print("JSON result error!", file=sys.stderr)
print("flypool_hs_{}_{}.value U".format(zcash_address, miner))
else:
try:
hash_rate = worker['currentHashrate']
except (KeyError, TypeError):
print("No current Hashrate!", file=sys.stderr)
print("flypool_hs_{}_{}.value U".format(zcash_address, miner))
else:
print("flypool_hs_{}_{}.value {}".format(zcash_address, miner, hash_rate))
print("flypool_hs_{}_{}.value {}".format(zcash_address, miner, hash_rate))