1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Plugin bitcoind_: introduce explicit configuration file path

The home directory of the currently effective UID cannot be easily
inferred in python via os.path.expanduser. Since there is no other
simple way for reaching this goal, an explicit environemnt setting is
introduced.
This commit is contained in:
Lars Kruse 2018-08-24 21:52:34 +02:00
parent 0a090e5be5
commit abdeb7ec65

View file

@ -14,8 +14,10 @@ This plugin supports two ways to do that:
[bitcoind_*]
user your-username
env.bitcoin_configfile /home/your-username/.bitcoin/bitcoin.conf
Then be sure your $HOME/.bitcoin/bitcoin.conf has the correct authentication info:
Then be sure that the file referenced above (typically: $HOME/.bitcoin/bitcoin.conf)
has the correct authentication info:
rpcconnect, rpcport, rpcuser, rpcpassword
2) Place your bitcoind authentication directly in /etc/munin/plugin-conf.d/bitcoin.conf
@ -97,8 +99,16 @@ def main():
bitcoin_options.rpcport = bitcoin_options.get('rpcport', '8332')
if bitcoin_options.get('rpcuser') is None:
conf_file = os.path.join(os.path.expanduser('~/.bitcoin'), 'bitcoin.conf')
bitcoin_options = parse_conf(conf_file)
conf_file = os.getenv("bitcoin_configfile")
if not conf_file:
print("Missing environment settings (rpcuser/rcpassword or bitcoin_configfile)",
file=sys.stderr)
sys.exit(1)
elif not os.path.exists(conf_file):
print("Configuration file does not exist: {}".format(conf_file), file=sys.stderr)
sys.exit(1)
else:
bitcoin_options = parse_conf(conf_file)
bitcoin_options.require('rpcuser', 'rpcpassword')