X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/dab49e324ed9791aa28e09d97b4023a8a398cb06..bb670c9eb8501639d3073dfa54c2d921ca8da5ee:/cookbooks/prometheus/recipes/server.rb?ds=sidebyside diff --git a/cookbooks/prometheus/recipes/server.rb b/cookbooks/prometheus/recipes/server.rb index d21227ee8..c8241a1f1 100644 --- a/cookbooks/prometheus/recipes/server.rb +++ b/cookbooks/prometheus/recipes/server.rb @@ -43,7 +43,7 @@ database_cluster = "#{node[:timescaledb][:database_version]}/main" postgresql_user "prometheus" do cluster database_cluster - createrole true + superuser true end postgresql_database "promscale" do @@ -51,11 +51,6 @@ postgresql_database "promscale" do owner "prometheus" end -postgresql_extension "timescaledb" do - cluster database_cluster - database "promscale" -end - directory "/opt/promscale" do owner "root" group "root" @@ -121,12 +116,6 @@ service "promscale" do subscribes :restart, "systemd_service[promscale]" end -postgresql_extension "promscale" do - cluster database_cluster - database "promscale" - notifies :restart, "service[promscale]" -end - systemd_service "promscale-maintenance" do description "Promscale Maintenace" type "simple" @@ -161,6 +150,7 @@ search(:node, "roles:gateway") do |gateway| end jobs = {} +snmp_targets = [] search(:node, "recipes:prometheus\\:\\:default").sort_by(&:name).each do |client| if client[:prometheus][:mode] == "wireguard" @@ -189,6 +179,15 @@ search(:node, "recipes:prometheus\\:\\:default").sort_by(&:name).each do |client :metric_relabel => metric_relabel } end + + Hash(client[:prometheus][:snmp]).each do |instance, details| + snmp_targets << { + :instance => instance, + :target => details[:address], + :module => details[:module], + :address => client[:prometheus][:addresses]["snmp"] + } + end end certificates = search(:node, "letsencrypt:certificates").each_with_object({}) do |n, c| @@ -229,7 +228,7 @@ template "/etc/prometheus/prometheus.yml" do owner "root" group "root" mode "644" - variables :jobs => jobs, :certificates => certificates + variables :jobs => jobs, :snmp_targets => snmp_targets, :certificates => certificates end template "/etc/prometheus/alert_rules.yml" do