mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
d6dcc5d379
This reverts commit a48cf87333
.
see the discussion:
https://github.com/munin-monitoring/contrib/pull/855
(the term 'htc' is probably too unknown and not really suitable)
37 lines
1.2 KiB
Python
Executable file
37 lines
1.2 KiB
Python
Executable file
#!/usr/bin/python
|
|
# based on https://github.com/pdbrown/munin-custom/blob/master/plugins/hashrate
|
|
# improved by @deveth0 (donation to 1GzHgp9hsDRsf96MnVk2oo6EG1VmWP9jGs :) )
|
|
# usage: set your api key in node-config, eg
|
|
# [slush_*]
|
|
# env.apikey foobar
|
|
import sys
|
|
import urllib2
|
|
import json
|
|
import os
|
|
|
|
SLUSH_URL = 'https://mining.bitcoin.cz/accounts/profile/json/'
|
|
API_KEY = os.getenv('apikey')
|
|
SLUSH_STATS = SLUSH_URL + API_KEY
|
|
|
|
mining_stats_raw = urllib2.urlopen(SLUSH_STATS)
|
|
mining_stats = json.load(mining_stats_raw)
|
|
|
|
command = ''
|
|
if len(sys.argv) > 1:
|
|
command = sys.argv[1]
|
|
|
|
if command == 'config':
|
|
print "graph_title Slush Rewards"
|
|
print "graph_args -l 0"
|
|
print "graph_vlabel BTC"
|
|
print "graph_category other"
|
|
print "unconfirmed_reward.label Unconfirmed Reward"
|
|
print "estimated_reward.label Estimeated Reward"
|
|
print "confirmed_reward.label Confirmed Reward"
|
|
print "send_threshold.label Send Threshold"
|
|
sys.exit(0)
|
|
|
|
print "unconfirmed_reward.value " +mining_stats['unconfirmed_reward']
|
|
print "estimated_reward.value " +mining_stats['estimated_reward']
|
|
print "confirmed_reward.value " +mining_stats['confirmed_reward']
|
|
print "send_threshold.value " +mining_stats['send_threshold']
|