]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/prometheus/templates/default/prometheus.yml.erb
Label targets with appropriate instance names
[chef.git] / cookbooks / prometheus / templates / default / prometheus.yml.erb
index 60345ef5258ee95577605a9b4901843154413e7c..66051b622dfc9098919246c7a3c2d6e758f11f03 100644 (file)
@@ -11,11 +11,13 @@ scrape_configs:
     static_configs:
       - targets:
           - localhost:9090
-<% @clients.each do |client| -%>
-  - job_name: <%= client.name %>
+<% @jobs.sort.each do |name, targets| -%>
+  - job_name: <%= name %>
     static_configs:
+<% targets.each do |target| -%>
       - targets:
-<% client[:prometheus][:exporters].sort.each do |_,address| -%>
-          - <%= address %>
+          - <%= target[:address] %>
+        labels:
+          instance: <%= target[:name].split(".").first %>
 <% end -%>
 <% end -%>