mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +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,16 +118,20 @@ def main():
|
||||||
username=bitcoin_options.rpcuser,
|
username=bitcoin_options.rpcuser,
|
||||||
password=bitcoin_options.rpcpassword)
|
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 error:
|
||||||
if command == 'autoconf':
|
print(error, file=sys.stderr)
|
||||||
print('no')
|
return False
|
||||||
return True
|
|
||||||
else:
|
|
||||||
# TODO: Better way to report errors to Munin-node.
|
|
||||||
print("Could not connect to Bitcoin server.", file=sys.stderr)
|
|
||||||
return False
|
|
||||||
|
|
||||||
if request_var in ('transactions', 'block_age'):
|
if request_var in ('transactions', 'block_age'):
|
||||||
(info, error) = bitcoin.getblockhash(info['blocks'])
|
(info, error) = bitcoin.getblockhash(info['blocks'])
|
||||||
|
@ -140,10 +144,6 @@ def main():
|
||||||
if memory_pool:
|
if memory_pool:
|
||||||
info['waiting'] = len(memory_pool)
|
info['waiting'] = len(memory_pool)
|
||||||
|
|
||||||
if command == 'autoconf':
|
|
||||||
print('yes')
|
|
||||||
return True
|
|
||||||
|
|
||||||
for label in line_labels:
|
for label in line_labels:
|
||||||
print("%s.value %s" % (label, info[label]))
|
print("%s.value %s" % (label, info[label]))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue