+ 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:
+ - targets:
+<% @snmp_targets.sort_by { |t| t[:instance] }.each do |target| -%>
+ - targets:
+ - "<%= target[:target] %>/<%= target[:module] %>/<%= target[:address] %>"
+ labels:
+ instance: <%= target[:instance] %>
+<% target[:labels].sort.each do |name, value| -%>
+ <%= name %>: <%= value %>