From 4848413b102b4643b0dbec409f0a45dd83cfc07f Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 17 Nov 2021 18:46:03 +0000 Subject: [PATCH] Move exporters to /opt/prometheus-exporters --- cookbooks/prometheus/recipes/default.rb | 8 ++------ cookbooks/prometheus/resources/collector.rb | 2 +- cookbooks/prometheus/resources/exporter.rb | 4 ++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cookbooks/prometheus/recipes/default.rb b/cookbooks/prometheus/recipes/default.rb index 85c5ec312..21200b8e9 100644 --- a/cookbooks/prometheus/recipes/default.rb +++ b/cookbooks/prometheus/recipes/default.rb @@ -43,14 +43,10 @@ end 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" @@ -117,7 +113,7 @@ end 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 diff --git a/cookbooks/prometheus/resources/collector.rb b/cookbooks/prometheus/resources/collector.rb index 4a0c22d9b..ef103c3c0 100644 --- a/cookbooks/prometheus/resources/collector.rb +++ b/cookbooks/prometheus/resources/collector.rb @@ -78,7 +78,7 @@ action_class do end def executable_path - "/opt/prometheus/collectors/#{new_resource.collector}/#{new_resource.collector}_collector" + "/opt/prometheus-exporters/collectors/#{new_resource.collector}/#{new_resource.collector}_collector" end def executable_options diff --git a/cookbooks/prometheus/resources/exporter.rb b/cookbooks/prometheus/resources/exporter.rb index ae0596885..2a22198df 100644 --- a/cookbooks/prometheus/resources/exporter.rb +++ b/cookbooks/prometheus/resources/exporter.rb @@ -103,7 +103,7 @@ action_class do 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 @@ -129,5 +129,5 @@ action_class do end def after_created - subscribes :restart, "git[/opt/prometheus]" + subscribes :restart, "git[/opt/prometheus-exporters]" end -- 2.39.5