+ instance: <%= target[:instance] %>
+<% end -%>
+ metric_relabel_configs:
+<% targets.each do |target| -%>
+<% target[:metric_relabel].each do |relabel| -%>
+ - source_labels: [instance,<%= relabel[:source_labels] %>]
+ regex: "<%= target[:instance] %>;<%= relabel[:regex] %>"
+ action: <%= relabel[:action] %>
+<% end -%>
+<% end -%>
+<% end -%>
+ - job_name: snmp
+ scrape_interval: 5m
+ scrape_timeout: 2m
+ metrics_path: /snmp
+ static_configs:
+<% @snmp_targets.sort_by { |t| t[:instance] }.each do |target| -%>
+ - targets:
+<% target[:modules].each do |module_name| -%>
+ - "<%= target[:target] %>/<%= module_name %>/<%= target[:address] %>"
+<% end -%>
+ labels:
+ instance: <%= target[:instance] %>
+<% target[:labels].sort.each do |name, value| -%>
+ <%= name %>: <%= value %>