diff options
author | Christopher Baines <mail@cbaines.net> | 2016-02-27 19:13:32 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2016-02-27 19:13:32 +0000 |
commit | ef8a8355e8f402f3843121b07a9c22eee3c400aa (patch) | |
tree | db9c9d7dfc94b2aab8be8c89fc816ee2e8afc1ba | |
parent | 250b4fc30e384beda81bd9f06f1b5d467c8799da (diff) | |
parent | 16f2cafa899a05ff5ebd5d438375d17c96646c7d (diff) | |
download | prometheus-pgbouncer-exporter-ef8a8355e8f402f3843121b07a9c22eee3c400aa.tar prometheus-pgbouncer-exporter-ef8a8355e8f402f3843121b07a9c22eee3c400aa.tar.gz |
Merge tag 'v1.6' into debian
Release 1.6
-rw-r--r-- | CHANGELOG | 7 | ||||
-rw-r--r-- | prometheus-pgbouncer-exporter.conf | 24 | ||||
-rw-r--r-- | prometheus-pgbouncer-exporter.service | 1 | ||||
-rw-r--r-- | prometheus_pgbouncer_exporter/__init__.py | 2 | ||||
-rw-r--r-- | prometheus_pgbouncer_exporter/cli.py | 17 | ||||
-rw-r--r-- | prometheus_pgbouncer_exporter/utils.py | 3 |
6 files changed, 48 insertions, 6 deletions
@@ -1,3 +1,10 @@ +prometheus-pgbouncer-exporter (1.6) + + * Make the pgbouncer host configurable + * Fix help strings + + -- Christopher Baines <mail@cbaines.net> Sat, 27 Feb 2016 17:55:20 +0000 + prometheus-pgbouncer-exporter (1.5) * Make the port and host configurable diff --git a/prometheus-pgbouncer-exporter.conf b/prometheus-pgbouncer-exporter.conf new file mode 100644 index 0000000..7f8cbfd --- /dev/null +++ b/prometheus-pgbouncer-exporter.conf @@ -0,0 +1,24 @@ +# The configuration for the prometheus-pgbouncer-exporter can be specified in +# the command line arguments, environmental variables, or a configuration file. +# +# By default, this file contains comments detailing some of the the default +# configuration values. If you don't want to use the default, uncomment and +# change the configuration value. + +# Host on which to expose metrics +#host = 0.0.0.0 + +# Port to connect to pgbouncer +#pgbouncer-port = 6432 + +# User to connect to pgbouncer with +#pgbouncer-user = pgbouncer + +# Host on which to connect to pgbouncer, default is to connect to via a socket +# to the local machine +#pgbouncer-host = + +# Databases to report metrics for, if this is not specified, all metrics will +# be reported. For example, if you want to export data from the pgbouncer and +# test databases: +#database = [pgbouncer, test] diff --git a/prometheus-pgbouncer-exporter.service b/prometheus-pgbouncer-exporter.service index c0f2c6d..b95ab6c 100644 --- a/prometheus-pgbouncer-exporter.service +++ b/prometheus-pgbouncer-exporter.service @@ -5,7 +5,6 @@ After=pgbouncer.service [Service] User=postgres -Environment='LICENCE_LOCATION=/usr/share/doc/prometheus-pgbouncer-exporter/copyright' ExecStart=/usr/bin/prometheus-pgbouncer-exporter [Install] diff --git a/prometheus_pgbouncer_exporter/__init__.py b/prometheus_pgbouncer_exporter/__init__.py index 707cd28..1ab0f46 100644 --- a/prometheus_pgbouncer_exporter/__init__.py +++ b/prometheus_pgbouncer_exporter/__init__.py @@ -1,3 +1,3 @@ __ver_major__ = 1 -__ver_minor__ = 4 +__ver_minor__ = 6 __version__ = "%d.%d" % (__ver_major__, __ver_minor__) diff --git a/prometheus_pgbouncer_exporter/cli.py b/prometheus_pgbouncer_exporter/cli.py index c6f4d24..4f55f1e 100644 --- a/prometheus_pgbouncer_exporter/cli.py +++ b/prometheus_pgbouncer_exporter/cli.py @@ -45,19 +45,20 @@ def main(): '--config', is_config_file=True, help='config file path', + env_var='CONFIG', ) p.add( '--port', default='9127', - help="Port to connect to pgbouncer", + help="Port on which to expose metrics", type=int, env_var='PORT', ) p.add( '--host', default='0.0.0.0', - help="Port to connect to pgbouncer", + help="Host on which to expose metrics", env_var='HOST', ) @@ -73,6 +74,12 @@ def main(): help="User to connect to pgbouncer with", env_var='PGBOUNCER_USER', ) + p.add( + '--pgbouncer-host', + default=None, + help="Host on which to connect to pgbouncer", + env_var='PGBOUNCER_HOST', + ) p.add( '--database', @@ -98,7 +105,11 @@ def main(): logging.info(p.format_values()) - connection = get_connection(options.pgbouncer_user, options.pgbouncer_port) + connection = get_connection( + options.pgbouncer_user, + options.pgbouncer_port, + options.pgbouncer_host, + ) REGISTRY.register(StatsCollector( connection=connection, diff --git a/prometheus_pgbouncer_exporter/utils.py b/prometheus_pgbouncer_exporter/utils.py index 12e9ddd..7f9aae0 100644 --- a/prometheus_pgbouncer_exporter/utils.py +++ b/prometheus_pgbouncer_exporter/utils.py @@ -14,11 +14,12 @@ import psycopg2 -def get_connection(user, port): +def get_connection(user, port, host): connection = psycopg2.connect( database='pgbouncer', user=user, port=port, + host=host, ) # pgbouncer does not support transactions (as it does not make sense to), |