From dc7216b15b33567990e864c855d928ac9e73ad07 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 1 Feb 2021 20:21:24 +0000 Subject: [PATCH] Disable table monitor for promscale postgres instance --- cookbooks/postgresql/attributes/default.rb | 1 + .../postgresql/templates/default/postgres_queries.yml.erb | 4 +++- cookbooks/timescaledb/recipes/default.rb | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cookbooks/postgresql/attributes/default.rb b/cookbooks/postgresql/attributes/default.rb index 4882e77b1..cc8c9a59e 100644 --- a/cookbooks/postgresql/attributes/default.rb +++ b/cookbooks/postgresql/attributes/default.rb @@ -1,5 +1,6 @@ default[:postgresql][:versions] = [] default[:postgresql][:clusters] = {} +default[:postgresql][:monitor_tables] = true default[:postgresql][:settings][:defaults][:port] = "5432" default[:postgresql][:settings][:defaults][:max_connections] = "100" default[:postgresql][:settings][:defaults][:ssl] = "true" diff --git a/cookbooks/postgresql/templates/default/postgres_queries.yml.erb b/cookbooks/postgresql/templates/default/postgres_queries.yml.erb index a61359d19..c2fc048c8 100644 --- a/cookbooks/postgresql/templates/default/postgres_queries.yml.erb +++ b/cookbooks/postgresql/templates/default/postgres_queries.yml.erb @@ -13,6 +13,7 @@ pg_postmaster: - start_time_seconds: usage: "GAUGE" description: "Time at which postmaster started" +<% if node[:postgresql][:monitor_tables] -%> pg_stat_user_tables: query: "SELECT current_database() datname, schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze, COALESCE(last_vacuum, '1970-01-01Z'), COALESCE(last_vacuum, '1970-01-01Z') as last_vacuum, COALESCE(last_autovacuum, '1970-01-01Z') as last_autovacuum, COALESCE(last_analyze, '1970-01-01Z') as last_analyze, COALESCE(last_autoanalyze, '1970-01-01Z') as last_autoanalyze, vacuum_count, autovacuum_count, analyze_count, autoanalyze_count FROM pg_stat_user_tables" @@ -120,7 +121,8 @@ pg_statio_user_tables: - tidx_blks_hit: usage: "COUNTER" description: "Number of buffer hits in this table's TOAST table indexes (if any)" - +<% end -%> + pg_database: query: "SELECT pg_database.oid AS datid, pg_database.datname, pg_database_size(pg_database.datname) AS size_bytes FROM pg_database" master: true diff --git a/cookbooks/timescaledb/recipes/default.rb b/cookbooks/timescaledb/recipes/default.rb index 4ae90c361..776cab655 100644 --- a/cookbooks/timescaledb/recipes/default.rb +++ b/cookbooks/timescaledb/recipes/default.rb @@ -30,6 +30,7 @@ memory_gb = (node[:memory][:total].to_f / 1024 / 1024).ceil node.default_unless[:postgresql][:versions] = [] node.default[:postgresql][:versions] |= [database_version] +node.default[:postgresql][:monitor_tables] = false node.default[:postgresql][:settings][database_version][:max_connections] = 500 node.default[:postgresql][:settings][database_version][:shared_buffers] = "#{memory_gb / 4}GB" node.default[:postgresql][:settings][database_version][:work_mem] = "#{memory_gb * 128 / 50 / node[:cpu][:total]}MB" -- 2.43.2