]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/postgresql/recipes/default.rb
Report database size and replication delay for postgres
[chef.git] / cookbooks / postgresql / recipes / default.rb
index b70d167140093e612afc541199bfcc1b398a0fae..6a05f34e4fad6412a3b5e8f6c4ff75b23be5366e 100644 (file)
@@ -158,7 +158,17 @@ ports = clusters.collect do |_, details|
   "port=#{details[:port]}"
 end
 
+template "/etc/prometheus/collectors/postgres_queries.yml" do
+  source "postgres_queries.yml.erb"
+  owner "root"
+  group "root"
+  mode "644"
+end
+
 prometheus_exporter "postgres" do
   port 9187
-  environment "DATA_SOURCE_NAME" => "user=postgres host=/run/postgresql #{ports.join(',')}"
+  user "postgres"
+  options "--extend.query-path=/etc/prometheus/collectors/postgres_queries.yml"
+  environment "DATA_SOURCE_NAME" => "user=postgres host=/run/postgresql #{ports.join(',')}",
+              "PG_EXPORTER_EXCLUDE_DATABASES" => "postgres,template0,template1"
 end