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

Plugin bitcoind_: improved error output

This commit is contained in:
Lars Kruse 2018-08-24 21:52:11 +02:00
parent 675f1f6962
commit 0a090e5be5

View file

@ -115,7 +115,8 @@ def main():
return return
else: else:
# TODO: Better way to report errors to Munin-node. # TODO: Better way to report errors to Munin-node.
raise ValueError("Could not connect to Bitcoin server.") print("Could not connect to Bitcoin server.", file=sys.stderr)
sys.exit(1)
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'])
@ -180,9 +181,9 @@ class Options(dict):
if self.get(name) is None: if self.get(name) is None:
missing.append(name) missing.append(name)
if len(missing) > 0: if len(missing) > 0:
raise ValueError("Missing required setting%s: %s." % print("Missing required setting%s: %s."
('s' if len(missing) > 1 else '', % ('s' if len(missing) > 1 else '', ', '.join(missing)), file=sys.stderr)
', '.join(missing))) sys.exit(1)
class ServiceProxy(object): class ServiceProxy(object):