Add vm_host label to prometheus targets
This commit is contained in:
@@ -79,6 +79,7 @@ jobs = node["kosmos_prometheus"]["jobs"].merge(
|
||||
"targets" => search(:node, config["query"]).map do |n|
|
||||
target = { "target" => "#{n['knife_zero']['host']}:#{config['port']}", "instance" => n.name }
|
||||
target["env"] = n.chef_environment if n.chef_environment
|
||||
target["vm_host"] = n["vm_host"] if n["vm_host"]
|
||||
target
|
||||
end.compact.sort_by { |t| t["instance"] },
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@ scrape_configs:
|
||||
<% if t['env'] %>
|
||||
env: <%= t['env'] %>
|
||||
<% end %>
|
||||
<% if t['vm_host'] %>
|
||||
vm_host: <%= t['vm_host'] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user