1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-26 02:48:28 +00:00
This commit is contained in:
Nils 2017-06-27 22:25:05 +02:00
parent 32c7266651
commit 497e66ddcb
2 changed files with 8 additions and 7 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
# ethermine_ # ethermine_hashrate_
# #
# Munin plugin to monitor your ethermine.org hashrate. # Munin plugin to monitor your ethermine.org hashrate.
# #
@ -9,10 +9,10 @@
# Licence: GPLv2 # Licence: GPLv2
# #
# USAGE # USAGE
# ethermine_<YOUR_PUBLIC_ETHEREUM_ADDRESS>_<YOUR_RIG_NAME> # ethermine_hashrate_<YOUR_PUBLIC_ETHEREUM_ADDRESS>_<YOUR_RIG_NAME>
# #
# EXAMPLE # EXAMPLE
# ln -s /usr/share/munin/plugins/ethermine_ /etc/munin/plugins/ethermine_3257bde8cf067ae6f1ddc0e4b140fe02e3c5e44f_mine # ln -s /usr/share/munin/plugins/ethermine_hashrate_ /etc/munin/plugins/ethermine_hashrate_3257bde8cf067ae6f1ddc0e4b140fe02e3c5e44f_mine
# #
from __future__ import print_function from __future__ import print_function
@ -31,7 +31,7 @@ try:
eth_address, miner = sys.argv[0].split("_")[1:] eth_address, miner = sys.argv[0].split("_")[1:]
except ValueError: except ValueError:
print("The filename of this plugin (or its symlink) should follow this pattern: " print("The filename of this plugin (or its symlink) should follow this pattern: "
"'<YOUR_PUBLIC_ETHEREUM_ADDRESS>_<YOUR_RIG_NAME>'", file=sys.stderr) "'ethermine_hashrate_<YOUR_PUBLIC_ETHEREUM_ADDRESS>_<YOUR_RIG_NAME>'", file=sys.stderr)
sys.exit(9) sys.exit(9)
if command == 'config': if command == 'config':

View file

@ -29,14 +29,14 @@ if len(sys.argv) > 1:
command = sys.argv[1] command = sys.argv[1]
try: try:
eth_address = sys.argv[0].split("_")[1:] eth_address = sys.argv[0][(sys.argv[0].rfind('_')+1):]
except ValueError: except ValueError:
print("The filename of this plugin (or its symlink) should follow this pattern: " print("The filename of this plugin (or its symlink) should follow this pattern: "
"'<YOUR_PUBLIC_ethEREUM_ADDRESS>'", file=sys.stderr) "'etherscan_balance_<YOUR_PUBLIC_ETHEREUM_ADDRESS>'", file=sys.stderr)
sys.exit(9) sys.exit(9)
if command == 'config': if command == 'config':
print("graph_title eth {}".format(eth_address)) print("graph_title ETH {}".format(eth_address))
print("graph_title Ethereum Address {}".format(eth_address)) print("graph_title Ethereum Address {}".format(eth_address))
print("graph_info Ethereum Account Balance for Address {}".format(eth_address)) print("graph_info Ethereum Account Balance for Address {}".format(eth_address))
print("graph_title Ethereum Balance") print("graph_title Ethereum Balance")
@ -47,6 +47,7 @@ if command == 'config':
ethercan_balance_api_url = 'https://api.etherscan.io/api?module=account&action=balance&tag=latest&address=' + eth_address ethercan_balance_api_url = 'https://api.etherscan.io/api?module=account&action=balance&tag=latest&address=' + eth_address
etherscan_req = urllib2.Request(ethercan_balance_api_url) etherscan_req = urllib2.Request(ethercan_balance_api_url)
# User-Agent
etherscan_req.add_header('User-Agent', 'Mozilla/5.0') etherscan_req.add_header('User-Agent', 'Mozilla/5.0')
try: try: