"port=#{details[:port]}"
end
-template "/etc/prometheus/collectors/postgres_queries.yml" do
+file "/etc/prometheus/collectors/postgres_queries.yml" do
+ action :delete
+end
+
+template "/etc/prometheus/exporters/postgres_queries.yml" do
source "postgres_queries.yml.erb"
owner "root"
group "root"
prometheus_exporter "postgres" do
port 9187
user "postgres"
- options "--extend.query-path=/etc/prometheus/collectors/postgres_queries.yml"
+ options "--extend.query-path=/etc/prometheus/exporters/postgres_queries.yml"
environment "DATA_SOURCE_NAME" => "user=postgres host=/run/postgresql #{ports.join(',')}",
"PG_EXPORTER_EXCLUDE_DATABASES" => "postgres,template0,template1"
+ subscribes :restart, "template[/etc/prometheus/exporters/postgres_queries.yml]"
end