-clusters.each do |name,details|
- suffix = name.tr("/", ":")
+clusters.each do |name, details|
+ prometheus_suffix = name.tr("/", "-")
+ prometheus_database = node[:postgresql][:monitor_database]
+
+ prometheus_exporter "postgres" do
+ port 10000 + details[:port].to_i
+ service "postgres-#{prometheus_suffix}"
+ labels "cluster" => name
+ scrape_interval "1m"
+ scrape_timeout "1m"
+ user "postgres"
+ options "--no-collector.process_idle --extend.query-path=/etc/prometheus/exporters/postgres_queries.yml"
+ environment "DATA_SOURCE_NAME" => "postgres:///#{prometheus_database}?host=/run/postgresql&port=#{details[:port]}"
+ restrict_address_families "AF_UNIX"
+ remove_ipc false
+ subscribes :restart, "template[/etc/prometheus/exporters/postgres_queries.yml]"
+ end
+
+ munin_suffix = name.tr("/", ":")