Skip to content

Commit

Permalink
Make postgres exporter connect as the prometheus user
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Oct 15, 2023
1 parent 23961a3 commit d3175b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cookbooks/postgresql/recipes/default.rb
Expand Up @@ -17,6 +17,8 @@
# limitations under the License.
#

require "uri"

include_recipe "apt::postgresql"
include_recipe "munin"
include_recipe "prometheus"
Expand Down Expand Up @@ -131,7 +133,6 @@
labels "cluster" => name
scrape_interval "1m"
scrape_timeout "1m"
user "postgres"
options %w[
--collector.database_wraparound
--collector.long_running_transactions
Expand All @@ -140,9 +141,8 @@
--collector.stat_wal_receiver
--collector.statio_user_indexes
]
environment "DATA_SOURCE_NAME" => "postgres:///#{prometheus_database}?host=/run/postgresql&port=#{details[:port]}"
environment "DATA_SOURCE_NAME" => "postgres:///#{prometheus_database}?host=/run/postgresql&port=#{details[:port]}&user=prometheus&password=#{URI.encode_uri_component(passwords['prometheus'])}"
restrict_address_families "AF_UNIX"
remove_ipc false
subscribes :restart, "template[/etc/prometheus/exporters/postgres_queries.yml]"
end

Expand Down

0 comments on commit d3175b1

Please sign in to comment.