directory "/opt/prometheus" do
action :delete
- owner "root"
- group "root"
- mode "755"
recursive true
- not_if { ::Dir.exist?("/opt/prometheus/.git") }
end
-git "/opt/prometheus" do
+git "/opt/prometheus-exporters" do
action :sync
repository "https://github.com/openstreetmap/prometheus-exporters.git"
revision "main"
unless node[:prometheus][:snmp].empty?
prometheus_exporter "snmp" do
port 9116
- options "--config.file=/opt/prometheus/exporters/snmp/snmp.yml"
+ options "--config.file=/opt/prometheus-exporters/exporters/snmp/snmp.yml"
register_target false
end
end
end
def executable_path
- "/opt/prometheus/exporters/#{new_resource.exporter}/#{new_resource.exporter}_exporter"
+ "/opt/prometheus-exporters/exporters/#{new_resource.exporter}/#{new_resource.exporter}_exporter"
end
def executable_options
end
def after_created
- subscribes :restart, "git[/opt/prometheus]"
+ subscribes :restart, "git[/opt/prometheus-exporters]"
end