]> arthur.barton.de Git - netdata.git/commitdiff
Merge pull request #2006 from l2isbad/postgres_plugin
authorCosta Tsaousis <costa@tsaousis.gr>
Thu, 23 Mar 2017 20:01:50 +0000 (22:01 +0200)
committerGitHub <noreply@github.com>
Thu, 23 Mar 2017 20:01:50 +0000 (22:01 +0200)
Postgres plugin option to exclude databases from poll added

conf.d/python.d/postgres.conf
python.d/postgres.chart.py

index d4d2bafcc799c0103440303acb935f0637bccc94..12dddae67ea2176115ff8360b0dce72c32986eec 100644 (file)
@@ -68,6 +68,7 @@
 #
 #     table_stats : false
 #     index_stats : false
+#     database_poll : 'dbase_name1 dbase_name2' # poll only specified databases (all other will be excluded from charts)
 #
 # Postfix permissions are configured at its pg_hba.conf file. You can
 # "trust" local clients to allow netdata to connect, or you can create
index d359bb4f7a587039315d9b5d927785c72159b7c9..1976e2a61c49a0bb025677ac4c347f47ec3829a1 100644 (file)
@@ -242,6 +242,7 @@ class Service(SimpleService):
         self.definitions = deepcopy(CHARTS)
         self.table_stats = configuration.pop('table_stats', False)
         self.index_stats = configuration.pop('index_stats', False)
+        self.database_poll = configuration.pop('database_poll', None)
         self.configuration = configuration
         self.connection = False
         self.is_superuser = False
@@ -281,6 +282,9 @@ class Service(SimpleService):
             is_superuser = check_if_superuser_(cursor, QUERIES['IF_SUPERUSER'])
             cursor.close()
 
+            if (self.database_poll and isinstance(self.database_poll, str)):
+                self.databases = [dbase for dbase in self.databases if dbase in self.database_poll.split()] or self.databases
+
             self.locks_zeroed = populate_lock_types(self.databases)
             self.add_additional_queries_(is_superuser)
             self.create_dynamic_charts_()