From f909a576fc235c79737c9ff8e3b0750375e84d73 Mon Sep 17 00:00:00 2001 From: Vince Fleming Date: Fri, 19 Apr 2024 13:30:12 -0400 Subject: [PATCH] added optional TLS proto --- export.py | 15 +++++++++++++-- export.yml | 4 +++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/export.py b/export.py index d0c5dda..9f5fffd 100644 --- a/export.py +++ b/export.py @@ -29,7 +29,7 @@ from wekalib.wekacluster import WekaCluster import wekalib.exceptions -VERSION = "1.7.1" +VERSION = "1.7.2" #VERSION = "experimental" @@ -94,6 +94,12 @@ def prom_client(config): if 'datapoints_per_collect' not in config['exporter']: config['exporter']['datapoints_per_collect'] = 1 + if 'certfile' not in config['exporter']: + config['exporter']['certfile'] = None + + if 'keyfile' not in config['exporter']: + config['exporter']['keyfile'] = None + log.info(f"Timeout set to {config['exporter']['timeout']} secs") try: @@ -143,7 +149,12 @@ def prom_client(config): # log.info(f"starting http server on port {config['exporter']['listen_port']}") try: - prometheus_client.start_http_server(int(config['exporter']['listen_port'])) + if config['exporter']['certfile'] is not None and config['exporter']['keyfile'] is not None: + prometheus_client.start_http_server(int(config['exporter']['listen_port']), + certfile=config['exporter']['certfile'], + keyfile=config['exporter']['keyfile']) + else: + prometheus_client.start_http_server(int(config['exporter']['listen_port'])) except Exception as exc: log.critical(f"Unable to start http server on port {config['exporter']['listen_port']}: {exc}") return 1 diff --git a/export.yml b/export.yml index b09444b..9cc5e4f 100644 --- a/export.yml +++ b/export.yml @@ -12,12 +12,14 @@ exporter: max_threads_per_proc: 100 backends_only: True datapoints_per_collect: 5 + certfile: null + keyfile: null # cluster section - info about the weka cluster we want to export data from: cluster: auth_token_file: auth-token.json hosts: - - 172.29.4.65 + - 172.29.0.63 force_https: False # only 3.10+ clusters support https verify_cert: False # default cert cannot be verified mgmt_port: 14000