From 7a362464b1d0abb08d912acf594e8c49c263460a Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 16 Jan 2016 17:33:03 +0000 Subject: Add version information --- prometheus_pgbouncer_exporter/__init__.py | 3 +++ prometheus_pgbouncer_exporter/cli.py | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/prometheus_pgbouncer_exporter/__init__.py b/prometheus_pgbouncer_exporter/__init__.py index e69de29..4fe83a7 100644 --- a/prometheus_pgbouncer_exporter/__init__.py +++ b/prometheus_pgbouncer_exporter/__init__.py @@ -0,0 +1,3 @@ +__ver_major__ = 1 +__ver_minor__ = 1 +__version__ = "%d.%d" % (__ver_major__, __ver_minor__) diff --git a/prometheus_pgbouncer_exporter/cli.py b/prometheus_pgbouncer_exporter/cli.py index f0807ce..acadd6f 100644 --- a/prometheus_pgbouncer_exporter/cli.py +++ b/prometheus_pgbouncer_exporter/cli.py @@ -22,6 +22,7 @@ from os.path import join, dirname, normpath from http.server import HTTPServer from prometheus_client.core import REGISTRY +from . import __version__ from .utils import get_connection from .exposition import create_request_handler from .collectors import StatsCollector, ListsCollector, PoolsCollector, \ @@ -35,6 +36,12 @@ def main(): ], ) + p.add( + '--version', + action='store_true', + help="Show the version", + ) + p.add( '-c', '--config', @@ -71,6 +78,10 @@ def main(): options = p.parse_args() + if options.version: + print("prometheus-pgbouncer-exporter %s" % __version__) + return + logging.basicConfig(level=logging.DEBUG) logging.info(p.format_values()) -- cgit v1.2.3