X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/3f5db81b561764ab48ff6f8f3cd9846b59a76d5a..8c004d45aa98d43f8c16336f22de5a4524053dd2:/cookbooks/postgresql/recipes/default.rb diff --git a/cookbooks/postgresql/recipes/default.rb b/cookbooks/postgresql/recipes/default.rb index b192080fb..47ec3e80b 100644 --- a/cookbooks/postgresql/recipes/default.rb +++ b/cookbooks/postgresql/recipes/default.rb @@ -154,8 +154,8 @@ clusters.each do |name, details| end end -ports = clusters.collect do |_, details| - details[:port] +uris = clusters.collect do |_, details| + "postgres@:#{details[:port]}/postgres?host=/run/postgresql" end template "/etc/prometheus/exporters/postgres_queries.yml" do @@ -169,7 +169,7 @@ 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", + environment "DATA_SOURCE_URI" => uris.sort.uniq.first, "PG_EXPORTER_AUTO_DISCOVER_DATABASES" => "true", "PG_EXPORTER_EXCLUDE_DATABASES" => "postgres,template0,template1" subscribes :restart, "template[/etc/prometheus/exporters/postgres_queries.yml]"