]> git.openstreetmap.org Git - chef.git/commitdiff
Add monitoring for unfrozen IDs in postgres databases
authorTom Hughes <tom@compton.nu>
Tue, 2 Mar 2021 18:24:22 +0000 (18:24 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 2 Mar 2021 18:53:10 +0000 (18:53 +0000)
cookbooks/postgresql/templates/default/postgres_queries.yml.erb

index c2fc048c8391cf8ff1f86bbd2d334d550246d04f..f513b33e7662cee3906b2f2acc158f951d13137b 100644 (file)
@@ -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"