From: Sebastian Harl Date: Sat, 16 Aug 2008 17:39:10 +0000 (+0200) Subject: postgresql_default.conf, postgresql plugin: Split default queries by category. X-Git-Tag: collectd-4.5.0~69 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=83b945c4ced534b0bdf94239cf62a1022abbb2cb;p=collectd.git postgresql_default.conf, postgresql plugin: Split default queries by category. The default queries have been split as follows: | old | new | +----------------+------------------------------------+ | database | backends, transactions | | user_tables | queries, query_plans, table_states | | io_user_tables | disk_io | This allows for a more fine-grained control over which statistics are to be collected. The documentation and default queries definition have been updated to reflect this change. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 58ffc783..40f5027e 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -1087,23 +1087,39 @@ B options has to match the columns of the query result. =back -The following predefined queries are available: +The following predefined queries are available (the definitions can be found +in the F file which, by default, is available at +C/share/collectd/>): =over 4 -=item B +=item B -This query collects general database statistics, i.Ee. the number of -backends and committed and rolled-back transactions. +This query collects the number of backends, i.Ee. the number of +connected clients. -=item B +=item B -This query collects user-table usage statistics, i.Ee. the numbers of -various table scans and the numbers of various table modifications. +This query collects the numbers of committed and rolled-back transactions of +the user tables. -=item B +=item B -This query collects block access counts for user-tables. +This query collects the numbers of various table modifications (i.Ee. +insertions, updates, deletions) of the user tables. + +=item B + +This query collects the numbers of various table scans and returned tuples of +the user tables. + +=item B + +This query collects the numbers of live and dead rows in the user tables. + +=item B + +This query collects disk block access counts for user tables. =back @@ -1184,8 +1200,8 @@ B for details. Specify a I which should be executed for the database connection. This may be any of the predefined or user-defined queries. If no such option is -given, it defaults to "database", "user_tables" and "io_user_tables". Else, -the specified queries are used only. +given, it defaults to "backends", "transactions", "queries", "query_plans", +"table_states", "disk_io". Else, the specified queries are used only. =back diff --git a/src/postgresql.c b/src/postgresql.c index 5bf06145..135a8270 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -123,9 +123,12 @@ typedef struct { } c_psql_database_t; static char *def_queries[] = { - "database", - "user_tables", - "io_user_tables" + "backends", + "transactions", + "queries", + "query_plans", + "table_states", + "disk_io" }; static int def_queries_num = STATIC_ARRAY_SIZE (def_queries); diff --git a/src/postgresql_default.conf b/src/postgresql_default.conf index d304de53..93a29b6a 100644 --- a/src/postgresql_default.conf +++ b/src/postgresql_default.conf @@ -1,37 +1,57 @@ # Pre-defined queries of collectd's postgresql plugin. - - Query "SELECT numbackends, xact_commit, xact_rollback \ - FROM pg_stat_database \ + + Query "SELECT count(*) \ + FROM pg_stat_activity \ WHERE datname = $1;" Param database Column pg_numbackends + + + + Query "SELECT xact_commit, xact_rollback \ + FROM pg_stat_database \ + WHERE datname = $1;" + + Param database + Column pg_xact commit Column pg_xact rollback - - Query "SELECT sum(seq_scan), sum(seq_tup_read), \ - sum(idx_scan), sum(idx_tup_fetch), \ - sum(n_tup_ins), sum(n_tup_upd), sum(n_tup_del), \ - sum(n_tup_hot_upd), sum(n_live_tup), sum(n_dead_tup) \ - FROM pg_stat_user_tables" - - Column pg_scan seq - Column pg_scan seq_tup_read - Column pg_scan idx - Column pg_scan idx_tup_fetch + + Query "SELECT sum(n_tup_ins), sum(n_tup_upd), sum(n_tup_del), \ + sum(n_tup_hot_upd) \ + FROM pg_stat_user_tables;" + Column pg_n_tup_c ins Column pg_n_tup_c upd Column pg_n_tup_c del Column pg_n_tup_c hot_upd + + + + Query "SELECT sum(seq_scan), sum(seq_tup_read), \ + sum(idx_scan), sum(idx_tup_fetch) \ + FROM pg_stat_user_tables;" + + Column pg_scan seq + Column pg_scan seq_tup_read + Column pg_scan idx + Column pg_scan idx_tup_fetch + + + + Query "SELECT sum(n_live_tup), sum(n_dead_tup) \ + FROM pg_stat_user_tables;" + Column pg_n_tup_g live Column pg_n_tup_g dead - + Query "SELECT sum(heap_blks_read), sum(heap_blks_hit), \ sum(idx_blks_read), sum(idx_blks_hit), \ sum(toast_blks_read), sum(toast_blks_hit), \