X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/26ef612058794425ff0bbceccffb27330a326e65..1cac4eb8d40ccb2d534f030c3329a456e03404bd:/cookbooks/prometheus/resources/exporter.rb diff --git a/cookbooks/prometheus/resources/exporter.rb b/cookbooks/prometheus/resources/exporter.rb index 8bbf1e5a4..08c0e03b7 100644 --- a/cookbooks/prometheus/resources/exporter.rb +++ b/cookbooks/prometheus/resources/exporter.rb @@ -45,6 +45,15 @@ action :create do subscribes :restart, "template[#{defaults_name}]" end + firewall_rule "accept-prometheus-#{new_resource.name}" do + action :accept + source "osm" + dest "fw" + proto "tcp:syn" + dest_ports new_resource.port + only_if { node[:prometheus][:mode] == "external" } + end + node.default[:prometheus][:exporters][new_resource.exporter] = listen_address end @@ -68,7 +77,11 @@ action_class do end def listen_address - "#{node.internal_ipaddress}:#{new_resource.port}" + if node[:prometheus][:mode] == "wireguard" + "[#{node[:prometheus][:address]}]:#{new_resource.port}" + else + "#{node[:prometheus][:address]}:#{new_resource.port}" + end end def service_name