aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2016-02-27 13:33:14 +0000
committerChristopher Baines <mail@cbaines.net>2016-02-27 13:58:34 +0000
commite1f286edcd2999e8990279da97de90e78e569ef6 (patch)
tree403eadaa65ffb3c6e5f7254f574b68a2ad0771a5
parente1dab5b45ec2e17c5c78d97adec05c251030aceb (diff)
downloadprometheus-pgbouncer-exporter-e1f286edcd2999e8990279da97de90e78e569ef6.tar
prometheus-pgbouncer-exporter-e1f286edcd2999e8990279da97de90e78e569ef6.tar.gz
Make the port and host configurable
-rw-r--r--prometheus_pgbouncer_exporter/cli.py21
1 files 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
@@ -51,6 +51,20 @@ def main():
)
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',
help="Port to connect to pgbouncer",
@@ -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()