+
+ def executable_name
+ "#{new_resource.exporter}_exporter"
+ end
+
+ def executable_architecture
+ node[:cpu][:architecture]
+ end
+
+ def executable_options
+ "--#{new_resource.listen_switch}=#{listen_argument} #{Array(new_resource.options).join(' ')}"
+ end
+
+ def listen_argument
+ case new_resource.listen_type
+ when "address" then listen_address
+ when "url" then "http://#{listen_address}/metrics"
+ end
+ end
+
+ def listen_address
+ if new_resource.address
+ "#{new_resource.address}:#{new_resource.port}"
+ elsif node[:prometheus][:mode] == "wireguard"
+ "[#{node[:prometheus][:address]}]:#{new_resource.port}"
+ else
+ "#{node[:prometheus][:address]}:#{new_resource.port}"
+ end
+ end
+end
+
+def after_created
+ subscribes :restart, "git[/opt/prometheus-exporters]"