]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/postgresql/templates/default/postgres_queries.yml.erb
Configure production site to use query.openstreetmap.org
[chef.git] / cookbooks / postgresql / templates / default / postgres_queries.yml.erb
index a61359d19ada2a6620830fd1ee8d7e13000ddf90..f513b33e7662cee3906b2f2acc158f951d13137b 100644 (file)
@@ -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
@@ -135,3 +137,16 @@ pg_database:
     - size_bytes:
         usage: "GAUGE"
         description: "Disk space used by the database"
+
+pg_unfrozen_ids:
+  query: "SELECT current_database() AS datname, max(age(relfrozenxid)) AS xid_age, max(mxid_age(relminmxid)) AS mxid_age FROM pg_class WHERE relkind IN ('r', 'm')"
+  metrics:
+    - datname:
+        usage: "LABEL"
+        description: "Name of the database"
+    - xid_age:
+        usage: "GAUGE"
+        description: "Age of the oldest unfrozen transaction ID in this database"
+    - mxid_age:
+        usage: "GAUGE"
+        description: "Age of the oldest unfrozen multixact ID in this database"