diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-03-16 07:50:45 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-03-16 07:50:45 +0000 |
commit | 87cce1817d03daca8c31be82d781ec47a4560087 (patch) | |
tree | 06cb3e407ea32dcc385cbe4fb77e251e34bc1e68 /collectors/python.d.plugin/postgres | |
parent | Releasing debian version 1.12.2-2. (diff) | |
download | netdata-87cce1817d03daca8c31be82d781ec47a4560087.tar.xz netdata-87cce1817d03daca8c31be82d781ec47a4560087.zip |
Merging upstream version 1.13.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-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) |