X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/2c47ce1f262afebbb0ace3b7d0cd0c19f5ce4739..e881af9e5b4f1d2ab5d32e995db8d4c2624f7bbc:/cookbooks/postgresql/recipes/default.rb diff --git a/cookbooks/postgresql/recipes/default.rb b/cookbooks/postgresql/recipes/default.rb index 4d7aec10e..b192080fb 100644 --- a/cookbooks/postgresql/recipes/default.rb +++ b/cookbooks/postgresql/recipes/default.rb @@ -155,12 +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