]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/prometheus/recipes/server.rb
Label targets with appropriate instance names
[chef.git] / cookbooks / prometheus / recipes / server.rb
index 5132eabdddcf3a6450e133ab7644dd4b119808c1..1e164cd1d3c751faf4d502034dc4e64a345a5532 100644 (file)
@@ -26,10 +26,10 @@ package "prometheus"
 
 clients = search(:node, "recipes:prometheus\\:\\:default").sort_by(&:name)
 
-prometheus_jobs = clients.each_with_object({}) do |client, jobs|
+prometheus_jobs = clients.sort_by(&:name).each_with_object({}) do |client, jobs|
   client[:prometheus][:exporters].each do |name, address|
     jobs[name] ||= []
-    jobs[name] << address
+    jobs[name] << { :address => address, :name => client.name }
   end
 end