root / plugins / currency / bitcoin / slush_reward_ @ a7139bca
Historique | Voir | Annoter | Télécharger (1,23 ko)
| 1 |
#!/usr/bin/env python |
|---|---|
| 2 |
# based on https://github.com/pdbrown/munin-custom/blob/master/plugins/hashrate |
| 3 |
# improved by @deveth0 (donation to 1GzHgp9hsDRsf96MnVk2oo6EG1VmWP9jGs :) ) |
| 4 |
# usage: set your api key in node-config, eg |
| 5 |
# [slush_*] |
| 6 |
# env.apikey foobar |
| 7 |
import sys |
| 8 |
import urllib2 |
| 9 |
import json |
| 10 |
import os |
| 11 |
|
| 12 |
SLUSH_URL = 'https://mining.bitcoin.cz/accounts/profile/json/' |
| 13 |
API_KEY = os.getenv('apikey')
|
| 14 |
SLUSH_STATS = SLUSH_URL + API_KEY |
| 15 |
|
| 16 |
mining_stats_raw = urllib2.urlopen(SLUSH_STATS) |
| 17 |
mining_stats = json.load(mining_stats_raw) |
| 18 |
|
| 19 |
command = '' |
| 20 |
if len(sys.argv) > 1: |
| 21 |
command = sys.argv[1] |
| 22 |
|
| 23 |
if command == 'config': |
| 24 |
print "graph_title Slush Rewards" |
| 25 |
print "graph_args -l 0" |
| 26 |
print "graph_vlabel BTC" |
| 27 |
print "graph_category htc" |
| 28 |
print "unconfirmed_reward.label Unconfirmed Reward" |
| 29 |
print "estimated_reward.label Estimeated Reward" |
| 30 |
print "confirmed_reward.label Confirmed Reward" |
| 31 |
print "send_threshold.label Send Threshold" |
| 32 |
sys.exit(0) |
| 33 |
|
| 34 |
print "unconfirmed_reward.value " +mining_stats['unconfirmed_reward'] |
| 35 |
print "estimated_reward.value " +mining_stats['estimated_reward'] |
| 36 |
print "confirmed_reward.value " +mining_stats['confirmed_reward'] |
| 37 |
print "send_threshold.value " +mining_stats['send_threshold'] |
