X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/b4b80ec4ce3e502101f6dc4f1a8aba4fb6e69b6b..e1891014c66d48af5b7c9fa8354f83804fa1a180:/cookbooks/postgresql/recipes/default.rb?ds=sidebyside diff --git a/cookbooks/postgresql/recipes/default.rb b/cookbooks/postgresql/recipes/default.rb index 0e29b2042..b192080fb 100644 --- a/cookbooks/postgresql/recipes/default.rb +++ b/cookbooks/postgresql/recipes/default.rb @@ -155,11 +155,22 @@ clusters.each do |name, details| end ports = clusters.collect do |_, details| - "port=#{details[:port]}" + 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" - environment "DATA_SOURCE_NAME" => "user=postgres host=/run/postgresql #{ports.join(',')}" + 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