From caf1a5281f9e974ba73ceded3a782db3d0142c5f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 26 Apr 2019 18:22:55 +0200 Subject: Merging upstream version 1.14.0. Signed-off-by: Daniel Baumann --- collectors/python.d.plugin/postgres/postgres.chart.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'collectors/python.d.plugin/postgres/postgres.chart.py') diff --git a/collectors/python.d.plugin/postgres/postgres.chart.py b/collectors/python.d.plugin/postgres/postgres.chart.py index cd8e78404..e5c3f2379 100644 --- a/collectors/python.d.plugin/postgres/postgres.chart.py +++ b/collectors/python.d.plugin/postgres/postgres.chart.py @@ -23,6 +23,7 @@ DEFAULT_CONNECT_TIMEOUT = 2 # seconds DEFAULT_STATEMENT_TIMEOUT = 5000 # ms +CONN_PARAM_DSN = 'dsn' CONN_PARAM_HOST = 'host' CONN_PARAM_PORT = 'port' CONN_PARAM_DATABASE = 'database' @@ -824,6 +825,10 @@ class Service(SimpleService): def build_conn_params(self): conf = self.configuration + # connection URIs: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING + if conf.get(CONN_PARAM_DSN): + return {'dsn': conf[CONN_PARAM_DSN]} + params = { CONN_PARAM_HOST: conf.get(CONN_PARAM_HOST), CONN_PARAM_PORT: conf.get(CONN_PARAM_PORT, DEFAULT_PORT), -- cgit v1.2.3