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:
parent
fd45fe6c8e
commit
88e027bebd
1 changed files with 12 additions and 12 deletions
|
@ -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]))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue