X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/3a31afdddc4082bd26bc0840ef53c1f77ad75c31..ff13884a1e237c946502c2a4c67dbb12c9eebdbd:/cookbooks/prometheus/templates/default/prometheus.yml.erb?ds=sidebyside diff --git a/cookbooks/prometheus/templates/default/prometheus.yml.erb b/cookbooks/prometheus/templates/default/prometheus.yml.erb index b7a3cf81e..d90c8292b 100644 --- a/cookbooks/prometheus/templates/default/prometheus.yml.erb +++ b/cookbooks/prometheus/templates/default/prometheus.yml.erb @@ -34,7 +34,17 @@ scrape_configs: - targets: - "<%= target[:address] %>" labels: - instance: <%= target[:name].split(".").first %> + instance: <%= target[:instance] %> +<% end -%> +<% end -%> + metric_relabel_configs: +<% @jobs.sort.each do |name, targets| -%> +<% targets.each do |target| -%> +<% target[:metric_relabel].each do |relabel| -%> + - source_labels: [instance,<%= relabel[:source_labels] %>] + regex: "<%= target[:instance] %>;<%= relabel[:regex] %>" + action: <%= relabel[:action] %> +<% end -%> <% end -%> <% end -%>