mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
bitcoin plugins: convert to unix line endings
This commit is contained in:
parent
994ff0d5d7
commit
a1846d2006
2 changed files with 75 additions and 75 deletions
|
@ -1,41 +1,41 @@
|
||||||
#!/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 btcguild_hashrate_YOURAPIKEY
|
# usage: link to btcguild_hashrate_YOURAPIKEY
|
||||||
import sys
|
import sys
|
||||||
import urllib2
|
import urllib2
|
||||||
import json
|
import json
|
||||||
|
|
||||||
URL = 'https://www.btcguild.com/api.php?api_key='
|
URL = 'https://www.btcguild.com/api.php?api_key='
|
||||||
API_KEY = sys.argv[0][(sys.argv[0].rfind('_')+1):]
|
API_KEY = sys.argv[0][(sys.argv[0].rfind('_')+1):]
|
||||||
|
|
||||||
STATS = URL + API_KEY
|
STATS = URL + API_KEY
|
||||||
|
|
||||||
print STATS
|
print STATS
|
||||||
|
|
||||||
command = ''
|
command = ''
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
command = sys.argv[1]
|
command = sys.argv[1]
|
||||||
|
|
||||||
header = {'User-Agent':'Mozilla/5.0'}
|
header = {'User-Agent':'Mozilla/5.0'}
|
||||||
request = urllib2.Request(STATS,headers=header)
|
request = urllib2.Request(STATS,headers=header)
|
||||||
mining_stats_raw = urllib2.urlopen(request)
|
mining_stats_raw = urllib2.urlopen(request)
|
||||||
mining_stats = json.load(mining_stats_raw)
|
mining_stats = json.load(mining_stats_raw)
|
||||||
workers = mining_stats['workers']
|
workers = mining_stats['workers']
|
||||||
|
|
||||||
|
|
||||||
if command == 'config':
|
if command == 'config':
|
||||||
print "graph_title BTCGuild Hashrate"
|
print "graph_title BTCGuild Hashrate"
|
||||||
print "graph_args --upper-limit 3000 -l 0"
|
print "graph_args --upper-limit 3000 -l 0"
|
||||||
print "graph_vlabel MHash/s"
|
print "graph_vlabel MHash/s"
|
||||||
print "graph_category Bitcoin"
|
print "graph_category Bitcoin"
|
||||||
for worker in workers:
|
for worker in workers:
|
||||||
label = workers[worker]['worker_name']
|
label = workers[worker]['worker_name']
|
||||||
print label + ".label " + label
|
print label + ".label " + label
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
for worker in workers:
|
for worker in workers:
|
||||||
hash_rate = workers[worker]['hash_rate']
|
hash_rate = workers[worker]['hash_rate']
|
||||||
label = workers[worker]['worker_name']
|
label = workers[worker]['worker_name']
|
||||||
print label + ".value %d" % int(hash_rate)
|
print label + ".value %d" % int(hash_rate)
|
||||||
|
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
#!/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_hashrate_YOURAPIKEY
|
# usage: link to slush_hashrate_YOURAPIKEY
|
||||||
import sys
|
import sys
|
||||||
import urllib2
|
import urllib2
|
||||||
import json
|
import json
|
||||||
|
|
||||||
SLUSH_URL = 'https://mining.bitcoin.cz/accounts/profile/json/'
|
SLUSH_URL = 'https://mining.bitcoin.cz/accounts/profile/json/'
|
||||||
API_KEY = sys.argv[0][(sys.argv[0].rfind('_')+1):]
|
API_KEY = sys.argv[0][(sys.argv[0].rfind('_')+1):]
|
||||||
SLUSH_STATS = SLUSH_URL + API_KEY
|
SLUSH_STATS = SLUSH_URL + API_KEY
|
||||||
|
|
||||||
mining_stats_raw = urllib2.urlopen(SLUSH_STATS)
|
mining_stats_raw = urllib2.urlopen(SLUSH_STATS)
|
||||||
mining_stats = json.load(mining_stats_raw)
|
mining_stats = json.load(mining_stats_raw)
|
||||||
workers = mining_stats['workers']
|
workers = mining_stats['workers']
|
||||||
|
|
||||||
command = ''
|
command = ''
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
command = sys.argv[1]
|
command = sys.argv[1]
|
||||||
|
|
||||||
if command == 'config':
|
if command == 'config':
|
||||||
print "graph_title Slush Hashrate"
|
print "graph_title Slush Hashrate"
|
||||||
print "graph_args --upper-limit 3000 -l 0"
|
print "graph_args --upper-limit 3000 -l 0"
|
||||||
print "graph_vlabel MHash/s"
|
print "graph_vlabel MHash/s"
|
||||||
print "graph_category Bitcoin"
|
print "graph_category Bitcoin"
|
||||||
for worker in workers:
|
for worker in workers:
|
||||||
label = worker.replace(".","_")
|
label = worker.replace(".","_")
|
||||||
print label + ".label " +label
|
print label + ".label " +label
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
for worker in workers:
|
for worker in workers:
|
||||||
hash_rate = workers[worker]['hashrate']
|
hash_rate = workers[worker]['hashrate']
|
||||||
label = worker.replace(".","_")
|
label = worker.replace(".","_")
|
||||||
print label + ".value %d" % int(hash_rate)
|
print label + ".value %d" % int(hash_rate)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue