Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / bitcoin / slush_reward_ @ 862bc213

Historique | Voir | Annoter | Télécharger (1,17 ko)

1
#!/usr/bin/python
2
# based on https://github.com/pdbrown/munin-custom/blob/master/plugins/hashrate
3
# improved by @deveth0 (donation to 1GzHgp9hsDRsf96MnVk2oo6EG1VmWP9jGs :) )
4
# usage: link to slush_reward_YOURAPIKEY
5
import sys
6
import urllib2
7
import json
8

    
9
SLUSH_URL = 'https://mining.bitcoin.cz/accounts/profile/json/'
10
API_KEY =  sys.argv[0][(sys.argv[0].rfind('_')+1):]
11
SLUSH_STATS = SLUSH_URL + API_KEY
12

    
13
mining_stats_raw = urllib2.urlopen(SLUSH_STATS)
14
mining_stats = json.load(mining_stats_raw)
15

    
16
command = ''
17
if len(sys.argv) > 1:
18
    command = sys.argv[1]
19

    
20
if command == 'config':
21
    print "graph_title Slush Rewards"
22
    print "graph_args -l 0"
23
    print "graph_vlabel BTC"
24
    print "graph_category Bitcoin"
25
    print "unconfirmed_reward.label Unconfirmed Reward"
26
    print "estimated_reward.label Estimeated Reward"
27
    print "confirmed_reward.label Confirmed Reward"
28
    print "send_threshold.label Send Threshold"
29
    sys.exit(0)
30

    
31
print "unconfirmed_reward.value " +mining_stats['unconfirmed_reward']
32
print "estimated_reward.value " +mining_stats['estimated_reward']
33
print "confirmed_reward.value "  +mining_stats['confirmed_reward']
34
print "send_threshold.value " +mining_stats['send_threshold']