From 9169fe98d01e044dd4289099dc8d665089da9e30 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 23 Feb 2025 00:32:18 +0000 Subject: [PATCH] Run taginfo collector via bundler --- cookbooks/prometheus/resources/collector.rb | 2 ++ cookbooks/taginfo/recipes/default.rb | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cookbooks/prometheus/resources/collector.rb b/cookbooks/prometheus/resources/collector.rb index ce68a7e5c..4171b874d 100644 --- a/cookbooks/prometheus/resources/collector.rb +++ b/cookbooks/prometheus/resources/collector.rb @@ -27,6 +27,7 @@ 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] @@ -42,6 +43,7 @@ action :create do 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}" diff --git a/cookbooks/taginfo/recipes/default.rb b/cookbooks/taginfo/recipes/default.rb index 729f92777..ef3913c60 100644 --- a/cookbooks/taginfo/recipes/default.rb +++ b/cookbooks/taginfo/recipes/default.rb @@ -232,7 +232,8 @@ node[:taginfo][:sites].each do |site| prometheus_collector "taginfo-#{site_name}" do interval "15m" user "taginfo" - path "#{directory}/taginfo/sources/metrics.rb" - options "#{directory}/data" + path node[:ruby][:bundle] + options "exec sources/metrics.rb #{directory}/data" + working_directory "#{directory}/taginfo" end end -- 2.39.5