]> git.openstreetmap.org Git - chef.git/blob - cookbooks/prometheus/templates/default/prometheus.yml.erb
Add infrastructure to support relabelling metrics
[chef.git] / cookbooks / prometheus / templates / default / prometheus.yml.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 global:
4   scrape_interval: 15s
5   evaluation_interval: 15s
6
7 alerting:
8   alertmanagers:
9     - path_prefix: /alertmanager
10       static_configs:
11         - targets:
12             - localhost:9093
13
14 rule_files:
15   - /etc/prometheus/*_rules.yml
16
17 scrape_configs:
18   - job_name: prometheus
19     scrape_interval: 5s
20     scrape_timeout: 5s
21     metrics_path: /prometheus/metrics
22     static_configs:
23       - targets:
24           - localhost:9090
25   - job_name: alertmanager
26     metrics_path: /alertmanager/metrics
27     static_configs:
28       - targets:
29           - localhost:9093
30 <% @jobs.sort.each do |name, targets| -%>
31   - job_name: <%= name %>
32     static_configs:
33 <% targets.each do |target| -%>
34       - targets:
35           - "<%= target[:address] %>"
36         labels:
37           instance: <%= target[:instance] %>
38 <% end -%>
39 <% end -%>
40     metric_relabel_configs:
41 <% @jobs.sort.each do |name, targets| -%>
42 <% targets.each do |target| -%>
43 <% target[:metric_relabel].each do |relabel| -%>
44       - source_labels: [instance,<%= relabel[:source_labels] %>]
45         regex: "<%= target[:instance] %>;<%= relabel[:regex] %>"
46         action: <%= relabel[:action] %>
47 <% end -%>
48 <% end -%>
49 <% end -%>
50
51 # remote_write:
52 #   - url: "http://localhost:9201/write"