]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/postgresql/recipes/default.rb
Disable SSL for postgres 9.1 on errol
[chef.git] / cookbooks / postgresql / recipes / default.rb
index 4e5068712259a4366f4cdacd886649f0e6539f3d..b192080fb00a7e5f3a3806bb00540ca65ed5e093 100644 (file)
@@ -19,6 +19,7 @@
 
 include_recipe "apt"
 include_recipe "munin"
+include_recipe "prometheus"
 
 package "locales-all"
 package "postgresql-common"
@@ -152,3 +153,24 @@ clusters.each do |name, details|
     conf_variables :port => details[:port]
   end
 end
+
+ports = clusters.collect do |_, details|
+  details[:port]
+end
+
+template "/etc/prometheus/exporters/postgres_queries.yml" do
+  source "postgres_queries.yml.erb"
+  owner "root"
+  group "root"
+  mode "644"
+end
+
+prometheus_exporter "postgres" do
+  port 9187
+  user "postgres"
+  options "--extend.query-path=/etc/prometheus/exporters/postgres_queries.yml"
+  environment "DATA_SOURCE_URI" => "postgres@:#{ports.join(',:')}/postgres?host=/run/postgresql",
+              "PG_EXPORTER_AUTO_DISCOVER_DATABASES" => "true",
+              "PG_EXPORTER_EXCLUDE_DATABASES" => "postgres,template0,template1"
+  subscribes :restart, "template[/etc/prometheus/exporters/postgres_queries.yml]"
+end