diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-03-16 07:50:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-03-16 07:50:20 +0000 |
commit | b26be28df9fd4db2106cc2a557966c9d2a7345d9 (patch) | |
tree | 437e6106c0aa2e73f2dd68d0551545ae503f60d7 /collectors/python.d.plugin/postgres | |
parent | Adding upstream version 1.12.2. (diff) | |
download | netdata-b26be28df9fd4db2106cc2a557966c9d2a7345d9.tar.xz netdata-b26be28df9fd4db2106cc2a557966c9d2a7345d9.zip |
Adding upstream version 1.13.0.upstream/1.13.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/postgres.chart.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/collectors/python.d.plugin/postgres/postgres.chart.py b/collectors/python.d.plugin/postgres/postgres.chart.py index e988eec36..48880bb08 100644 --- a/collectors/python.d.plugin/postgres/postgres.chart.py +++ b/collectors/python.d.plugin/postgres/postgres.chart.py @@ -792,7 +792,6 @@ class Service(SimpleService): self.do_table_stats = configuration.pop('table_stats', False) self.do_index_stats = configuration.pop('index_stats', False) self.databases_to_poll = configuration.pop('database_poll', None) - self.statement_timeout = configuration.pop('statement_timeout', DEFAULT_STATEMENT_TIMEOUT) self.configuration = configuration self.conn = None self.server_version = None @@ -812,18 +811,20 @@ class Service(SimpleService): self.conn.close() self.conn = None - try: - params = dict( - host=None, - port=DEFAULT_PORT, - database=None, - user=DEFAULT_USER, - password=None, - connect_timeout=DEFAULT_CONNECT_TIMEOUT, - options='-c statement_timeout={0}'.format(self.statement_timeout), - ) - params.update(self.configuration) + conf = self.configuration + params = { + 'host': conf.get('host'), + 'port': conf.get('port', DEFAULT_PORT), + 'database': conf.get('database'), + 'user': conf.get('user', DEFAULT_USER), + 'password': conf.get('password'), + 'connect_timeout': conf.get('connect_timeout', DEFAULT_CONNECT_TIMEOUT), + 'options': '-c statement_timeout={0}'.format( + conf.get('statement_timeout', DEFAULT_STATEMENT_TIMEOUT)), + } + + try: self.conn = psycopg2.connect(**params) self.conn.set_isolation_level(extensions.ISOLATION_LEVEL_AUTOCOMMIT) self.conn.set_session(readonly=True) |