mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
print magic value U if error
This commit is contained in:
parent
e2db693c0d
commit
8a72386a30
@ -82,24 +82,25 @@ except IOError as exc:
|
|||||||
print("Failed to request Flypool API: {}".format(exc), file=sys.stderr)
|
print("Failed to request Flypool API: {}".format(exc), file=sys.stderr)
|
||||||
sys.exit(9)
|
sys.exit(9)
|
||||||
|
|
||||||
|
# manage codec and error handling lookup process
|
||||||
reader = codecs.getreader("utf-8")
|
reader = codecs.getreader("utf-8")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mining_stats = json.load(reader(mining_stats_raw))
|
mining_stats = json.load(reader(mining_stats_raw))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("Failed to parse JSON responce.", file=sys.stderr)
|
print("Failed to parse JSON responce.", file=sys.stderr)
|
||||||
sys.exit(9)
|
print("flypool_hs_{}_{}.value U".format(zcash_address, miner))
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
worker = mining_stats['data']
|
worker = mining_stats['data']
|
||||||
except (KeyError, TypeError):
|
except (KeyError, TypeError):
|
||||||
print("JSON result error!", file=sys.stderr)
|
print("JSON result error!", file=sys.stderr)
|
||||||
sys.exit(9)
|
print("flypool_hs_{}_{}.value U".format(zcash_address, miner))
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
hash_rate = worker['currentHashrate']
|
hash_rate = worker['currentHashrate']
|
||||||
except (KeyError, TypeError):
|
except (KeyError, TypeError):
|
||||||
print("No current Hashrate!", file=sys.stderr)
|
print("No current Hashrate!", file=sys.stderr)
|
||||||
sys.exit(9)
|
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))
|
||||||
|
Loading…
Reference in New Issue
Block a user