X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/39e9c0f23c2c459285df473de8011221f429dbad..9ea8869c986548bd40b63d4e98cd6ab294f01c83:/cookbooks/prometheus/resources/collector.rb?ds=sidebyside diff --git a/cookbooks/prometheus/resources/collector.rb b/cookbooks/prometheus/resources/collector.rb index 0ae8320f7..ce68a7e5c 100644 --- a/cookbooks/prometheus/resources/collector.rb +++ b/cookbooks/prometheus/resources/collector.rb @@ -24,6 +24,7 @@ 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 :proc_subset, String @@ -31,10 +32,12 @@ property :capability_bounding_set, [String, Array] property :private_devices, [true, false] property :private_users, [true, false] property :protect_clock, [true, false] +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" @@ -49,6 +52,7 @@ action :create do private_devices new_resource.private_devices if new_resource.property_is_set?(:private_devices) private_users new_resource.private_users if new_resource.property_is_set?(:private_users) protect_clock new_resource.protect_clock if new_resource.property_is_set?(:protect_clock) + protect_kernel_modules new_resource.protect_kernel_modules if new_resource.property_is_set?(:protect_kernel_modules) read_write_paths ["/var/lib/prometheus/node-exporter", "/var/lock", "/var/log"] end @@ -88,7 +92,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