aboutsummaryrefslogtreecommitdiff
path: root/prometheus_pgbouncer_exporter
diff options
context:
space:
mode:
Diffstat (limited to 'prometheus_pgbouncer_exporter')
-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())