From e1f286edcd2999e8990279da97de90e78e569ef6 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 27 Feb 2016 13:33:14 +0000 Subject: Make the port and host configurable --- prometheus_pgbouncer_exporter/cli.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/prometheus_pgbouncer_exporter/cli.py b/prometheus_pgbouncer_exporter/cli.py index 30460f8..2da21c1 100644 --- a/prometheus_pgbouncer_exporter/cli.py +++ b/prometheus_pgbouncer_exporter/cli.py @@ -50,6 +50,20 @@ def main(): help='config file path', ) + p.add( + '--port', + default='9127', + help="Port to connect to pgbouncer", + type=int, + env_var='PORT', + ) + p.add( + '--host', + default='0.0.0.0', + help="Port to connect to pgbouncer", + env_var='HOST', + ) + p.add( '--pgbouncer-port', default='6432', @@ -108,15 +122,12 @@ def main(): connection=connection, )) - host = '0.0.0.0' - port = 9127 - httpd = HTTPServer( - (host, port), + (options.host, options.port), create_request_handler(options.licence_location), ) - logging.info("Listing on port %s:%d" % (host, port)) + logging.info("Listing on port %s:%d" % (options.host, options.port)) try: httpd.serve_forever() -- cgit v1.2.3