]> 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 b00c6aaf021b8c9275712e54aef6253b60e116c1..66051b622dfc9098919246c7a3c2d6e758f11f03 100644 (file)
@@ -11,11 +11,13 @@ scrape_configs:
     static_configs:
       - targets:
           - localhost:9090
-<% @jobs.sort.each do |name, addresses| -%>
+<% @jobs.sort.each do |name, targets| -%>
   - job_name: <%= name %>
     static_configs:
+<% targets.each do |target| -%>
       - targets:
-<% addresses.sort.each do |address| -%>
-          - <%= address %>
+          - <%= target[:address] %>
+        labels:
+          instance: <%= target[:name].split(".").first %>
 <% end -%>
 <% end -%>