postgres_plugin: option to exclude databases from poll added
Ilya committed
Mar 23, 2017 at 23:16 UTC
d31074058c1a217de383dd85eca1e2a77aba7579
1 file changed
+4
python.d/postgres.chart.py
+4
@@ -242,6 +242,7 @@ class Service(SimpleService):
242
self.definitions = deepcopy(CHARTS)
243
self.table_stats = configuration.pop('table_stats', False)
244
self.index_stats = configuration.pop('index_stats', False)
245
+ self.database_poll = configuration.pop('database_poll', None)
246
self.configuration = configuration
247
self.connection = False
248
self.is_superuser = False
@@ -281,6 +282,9 @@ class Service(SimpleService):
282
is_superuser = check_if_superuser_(cursor, QUERIES['IF_SUPERUSER'])
283
cursor.close()
284
285
+ if (self.database_poll and isinstance(self.database_poll, str)):
286
+ self.databases = [dbase for dbase in self.databases if dbase in self.database_poll.split()] or self.databases
287
+
288
self.locks_zeroed = populate_lock_types(self.databases)
289
self.add_additional_queries_(is_superuser)
290
self.create_dynamic_charts_()