diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-04-26 16:22:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-04-26 16:22:17 +0000 |
commit | 58b482856cf37b0519e516ab8dc1105ba958f8b2 (patch) | |
tree | 0c46396e98741dfae4ce907bc8ef8c54418b3753 /collectors/python.d.plugin/postgres | |
parent | Adding upstream version 1.14.0~rc0. (diff) | |
download | netdata-58b482856cf37b0519e516ab8dc1105ba958f8b2.tar.xz netdata-58b482856cf37b0519e516ab8dc1105ba958f8b2.zip |
Adding upstream version 1.14.0.upstream/1.14.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/python.d.plugin/postgres')
-rw-r--r-- | collectors/python.d.plugin/postgres/README.md | 2 | ||||
-rw-r--r-- | collectors/python.d.plugin/postgres/postgres.chart.py | 5 | ||||
-rw-r--r-- | collectors/python.d.plugin/postgres/postgres.conf | 9 |
3 files changed, 13 insertions, 3 deletions
diff --git a/collectors/python.d.plugin/postgres/README.md b/collectors/python.d.plugin/postgres/README.md index 9939a0c48..052de94f4 100644 --- a/collectors/python.d.plugin/postgres/README.md +++ b/collectors/python.d.plugin/postgres/README.md @@ -49,6 +49,8 @@ Following charts are drawn: ### configuration +For all available options please see module [configuration file](postgres.conf). + ```yaml socket: name : 'socket' 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), diff --git a/collectors/python.d.plugin/postgres/postgres.conf b/collectors/python.d.plugin/postgres/postgres.conf index 4c4d5d1af..3dd461408 100644 --- a/collectors/python.d.plugin/postgres/postgres.conf +++ b/collectors/python.d.plugin/postgres/postgres.conf @@ -63,6 +63,10 @@ # # Connections can be configured with the following options: # +# dsn : 'connection URI' # see https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING +# +# OR +# # database : 'example_db_name' # user : 'example_user' # password : 'example_pass' @@ -70,14 +74,14 @@ # port : 5432 # connect_timeout : 2 # in seconds, default is 2 # statement_timeout : 2000 # in ms, default is 2000 -# -# SSL connection parameters (https://www.postgresql.org/docs/current/libpq-ssl.html) # sslmode : mode # one of [disable, allow, prefer, require, verify-ca, verify-full] # sslrootcert : path/to/rootcert # the location of the root certificate file # sslcrl : path/to/crl # the location of the CRL file # sslcert : path/to/cert # the location of the client certificate file # sslkey : path/to/key # the location of the client key file # +# SSL connection parameters description: https://www.postgresql.org/docs/current/libpq-ssl.html +# # Additionally, the following options allow selective disabling of charts # # table_stats : false @@ -128,4 +132,3 @@ tcpipv6: user : 'postgres' host : '::1' port : 5432 - |