aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2016-01-16 17:33:03 +0000
committerChristopher Baines <mail@cbaines.net>2016-01-16 20:54:48 +0000
commit7a362464b1d0abb08d912acf594e8c49c263460a (patch)
tree481d8456fbfd1a5d9739c408f478830d493ba321
parent4cc7518af449d2695ba001f05574137ba256f566 (diff)
downloadprometheus-pgbouncer-exporter-7a362464b1d0abb08d912acf594e8c49c263460a.tar
prometheus-pgbouncer-exporter-7a362464b1d0abb08d912acf594e8c49c263460a.tar.gz
Add version information
-rw-r--r--prometheus_pgbouncer_exporter/__init__.py3
-rw-r--r--prometheus_pgbouncer_exporter/cli.py11
2 files changed, 14 insertions, 0 deletions
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, \
@@ -36,6 +37,12 @@ def main():
)
p.add(
+ '--version',
+ action='store_true',
+ help="Show the version",
+ )
+
+ p.add(
'-c',
'--config',
is_config_file=True,
@@ -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())