From: Tom Hughes Date: Sun, 23 Apr 2023 13:14:18 +0000 (+0100) Subject: Collect taginfo metrics X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/f1757eb289e5b4ef0fc1f34f1c9e74cc16221af0 Collect taginfo metrics --- diff --git a/cookbooks/prometheus/resources/collector.rb b/cookbooks/prometheus/resources/collector.rb index 9a4870f24..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 @@ -91,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 diff --git a/cookbooks/taginfo/metadata.rb b/cookbooks/taginfo/metadata.rb index 5e468f00c..90517c121 100644 --- a/cookbooks/taginfo/metadata.rb +++ b/cookbooks/taginfo/metadata.rb @@ -11,4 +11,5 @@ depends "apache" depends "git" depends "passenger" depends "planet" +depends "prometheus" depends "ruby" diff --git a/cookbooks/taginfo/recipes/default.rb b/cookbooks/taginfo/recipes/default.rb index 613fe7d1d..818561930 100644 --- a/cookbooks/taginfo/recipes/default.rb +++ b/cookbooks/taginfo/recipes/default.rb @@ -24,6 +24,7 @@ include_recipe "apache" include_recipe "git" include_recipe "passenger" include_recipe "planet::current" +include_recipe "prometheus" include_recipe "ruby" package %w[ @@ -219,4 +220,11 @@ node[:taginfo][:sites].each do |site| service "taginfo-update@#{site_name}.timer" do action [:enable, :start] end + + prometheus_collector "taginfo-#{site_name}" do + interval "15m" + user "taginfo" + path "#{directory}/taginfo/sources/metrics.rb" + options "#{directory}/data" + end end