]> git.openstreetmap.org Git - chef.git/commitdiff
Move exporters to /opt/prometheus-exporters
authorTom Hughes <tom@compton.nu>
Wed, 17 Nov 2021 18:46:03 +0000 (18:46 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 17 Nov 2021 18:46:03 +0000 (18:46 +0000)
cookbooks/prometheus/recipes/default.rb
cookbooks/prometheus/resources/collector.rb
cookbooks/prometheus/resources/exporter.rb

index 85c5ec3129363a7da21b5bc0ff07f5198043911a..21200b8e93bb62e3c865a6d8972ca52febb69daa 100644 (file)
@@ -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
index 4a0c22d9b61a28dcfe1e8b0bd010b4cdbf5d60b7..ef103c3c0733d778c7fe84d9a56b0aaffd12cf48 100644 (file)
@@ -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
index ae0596885b07220efd3d9a1d09ace9c3e34be211..2a22198df32b57e04ea4df6225ee0c9d4e5c3e2c 100644 (file)
@@ -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