]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/prometheus/resources/collector.rb
Run taginfo collector via bundler
[chef.git] / cookbooks / prometheus / resources / collector.rb
index 1dfd8764df27e873b727caf7a34e8a688b22d4d6..4171b874d987c5496c96abea35a85b85cafc2409 100644 (file)
@@ -24,8 +24,10 @@ default_action :create
 property :collector, :kind_of => String, :name_property => true
 property :interval, :kind_of => [Integer, String], :required => [:create]
 property :user, :kind_of => String
+property :path, :kind_of => String
 property :options, :kind_of => [String, Array]
 property :environment, :kind_of => Hash, :default => {}
+property :working_directory, String
 property :proc_subset, String
 property :capability_bounding_set, [String, Array]
 property :private_devices, [true, false]
@@ -36,10 +38,12 @@ property :protect_kernel_modules, [true, false]
 action :create do
   systemd_service service_name do
     description "Prometheus #{new_resource.collector} collector"
+    type "oneshot"
     user new_resource.user
     dynamic_user new_resource.user.nil?
     group "adm"
     environment new_resource.environment
+    working_directory new_resource.working_directory
     standard_output "file:/var/lib/prometheus/node-exporter/#{new_resource.collector}.new"
     standard_error "journal"
     exec_start "#{executable_path} #{executable_options}"
@@ -90,7 +94,7 @@ action_class do
   end
 
   def executable_path
-    "/opt/prometheus-exporters/collectors/#{new_resource.collector}/#{new_resource.collector}_collector"
+    new_resource.path || "/opt/prometheus-exporters/collectors/#{new_resource.collector}/#{new_resource.collector}_collector"
   end
 
   def executable_options