Set node name as prometheus instance name
And DRY up the recipe so it's easy and expressive to add more metrics/targets
This commit is contained in:
@@ -14,11 +14,13 @@ scrape_configs:
|
||||
<% end %>
|
||||
metrics_path: "<%= job.fetch('metrics_path', '/metrics') %>"
|
||||
static_configs:
|
||||
- targets: <%= Array(job['targets']) %>
|
||||
<% if job['labels'] %>
|
||||
<% job['targets'].each do |t| %>
|
||||
- targets:
|
||||
- <%= t['target'] %>
|
||||
labels:
|
||||
<% job['labels'].each do |label, label_config| %>
|
||||
<%= label %>: <%= label_config %>
|
||||
instance: <%= t['instance'] %>
|
||||
<% if t['env'] %>
|
||||
env: <%= t['env'] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user