From: Tom Hughes Date: Tue, 2 Mar 2021 18:24:22 +0000 (+0000) Subject: Add monitoring for unfrozen IDs in postgres databases X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/413c1c7fc1a2954eca448a0c78de1272f3029609?ds=inline;hp=-c Add monitoring for unfrozen IDs in postgres databases --- 413c1c7fc1a2954eca448a0c78de1272f3029609 diff --git a/cookbooks/postgresql/templates/default/postgres_queries.yml.erb b/cookbooks/postgresql/templates/default/postgres_queries.yml.erb index c2fc048c8..f513b33e7 100644 --- a/cookbooks/postgresql/templates/default/postgres_queries.yml.erb +++ b/cookbooks/postgresql/templates/default/postgres_queries.yml.erb @@ -137,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"