mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Update slush_reward_
Moved from filename to env parameter to prevent the api-key displayed as graph name
This commit is contained in:
parent
84866ca679
commit
2fbd179fa2
1 changed files with 37 additions and 34 deletions
|
@ -1,34 +1,37 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# based on https://github.com/pdbrown/munin-custom/blob/master/plugins/hashrate
|
# based on https://github.com/pdbrown/munin-custom/blob/master/plugins/hashrate
|
||||||
# improved by @deveth0 (donation to 1GzHgp9hsDRsf96MnVk2oo6EG1VmWP9jGs :) )
|
# improved by @deveth0 (donation to 1GzHgp9hsDRsf96MnVk2oo6EG1VmWP9jGs :) )
|
||||||
# usage: link to slush_reward_YOURAPIKEY
|
# usage: set your api key in node-config, eg
|
||||||
import sys
|
# [slush_*]
|
||||||
import urllib2
|
# env.apikey foobar
|
||||||
import json
|
import sys
|
||||||
|
import urllib2
|
||||||
SLUSH_URL = 'https://mining.bitcoin.cz/accounts/profile/json/'
|
import json
|
||||||
API_KEY = sys.argv[0][(sys.argv[0].rfind('_')+1):]
|
import os
|
||||||
SLUSH_STATS = SLUSH_URL + API_KEY
|
|
||||||
|
SLUSH_URL = 'https://mining.bitcoin.cz/accounts/profile/json/'
|
||||||
mining_stats_raw = urllib2.urlopen(SLUSH_STATS)
|
API_KEY = os.getenv('apikey')
|
||||||
mining_stats = json.load(mining_stats_raw)
|
SLUSH_STATS = SLUSH_URL + API_KEY
|
||||||
|
|
||||||
command = ''
|
mining_stats_raw = urllib2.urlopen(SLUSH_STATS)
|
||||||
if len(sys.argv) > 1:
|
mining_stats = json.load(mining_stats_raw)
|
||||||
command = sys.argv[1]
|
|
||||||
|
command = ''
|
||||||
if command == 'config':
|
if len(sys.argv) > 1:
|
||||||
print "graph_title Slush Rewards"
|
command = sys.argv[1]
|
||||||
print "graph_args -l 0"
|
|
||||||
print "graph_vlabel BTC"
|
if command == 'config':
|
||||||
print "graph_category Bitcoin"
|
print "graph_title Slush Rewards"
|
||||||
print "unconfirmed_reward.label Unconfirmed Reward"
|
print "graph_args -l 0"
|
||||||
print "estimated_reward.label Estimeated Reward"
|
print "graph_vlabel BTC"
|
||||||
print "confirmed_reward.label Confirmed Reward"
|
print "graph_category Bitcoin"
|
||||||
print "send_threshold.label Send Threshold"
|
print "unconfirmed_reward.label Unconfirmed Reward"
|
||||||
sys.exit(0)
|
print "estimated_reward.label Estimeated Reward"
|
||||||
|
print "confirmed_reward.label Confirmed Reward"
|
||||||
print "unconfirmed_reward.value " +mining_stats['unconfirmed_reward']
|
print "send_threshold.label Send Threshold"
|
||||||
print "estimated_reward.value " +mining_stats['estimated_reward']
|
sys.exit(0)
|
||||||
print "confirmed_reward.value " +mining_stats['confirmed_reward']
|
|
||||||
print "send_threshold.value " +mining_stats['send_threshold']
|
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']
|
||||||
|
|
Loading…
Reference in a new issue