1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

Plugin bitcoind_: demystify "autoconf" handling

This commit is contained in:
Lars Kruse 2019-07-24 13:40:00 +02:00
parent fd45fe6c8e
commit 88e027bebd

View file

@ -118,15 +118,19 @@ def main():
username=bitcoin_options.rpcuser,
password=bitcoin_options.rpcpassword)
(info, error) = bitcoin.getinfo()
(info, connect_error) = bitcoin.getinfo()
if connect_error:
error = "Could not connect to Bitcoin server: {}".format(connect_error)
if command == 'autoconf':
if error:
print('no ({})'.format(error))
else:
print('yes')
return True
if error:
if command == 'autoconf':
print('no')
return True
else:
# TODO: Better way to report errors to Munin-node.
print("Could not connect to Bitcoin server.", file=sys.stderr)
print(error, file=sys.stderr)
return False
if request_var in ('transactions', 'block_age'):
@ -140,10 +144,6 @@ def main():
if memory_pool:
info['waiting'] = len(memory_pool)
if command == 'autoconf':
print('yes')
return True
for label in line_labels:
print("%s.value %s" % (label, info[label]))