]> git.openstreetmap.org Git - chef.git/blob - cookbooks/prometheus/templates/default/prometheus.yml.erb
Add alert for failing discourse jobs
[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   - job_name: promscale
31     static_configs:
32       - targets:
33           - localhost:9201
34   - job_name: ssl
35     scrape_interval: 15m
36     metrics_path: /probe
37     static_configs:
38 <% @certificates.values.sort_by { |c| c[:domains].first }.each do |certificate| -%>
39       - targets:
40 <% certificate[:nodes].sort_by { |h| h[:name] }.each do |host| -%>
41           - <%= certificate[:domains].first %>/<%= host[:name] %>:443
42 <% end -%>
43         labels:
44           domain: <%= certificate[:domains].first %>
45 <% end -%>
46     relabel_configs:
47       - source_labels: [__address__]
48         regex: "([^/]+)/.*"
49         target_label: __param_module
50       - source_labels: [__address__]
51         regex: "[^/]+/(.*)"
52         target_label: __param_target
53       - source_labels: [__param_target]
54         regex: "([^.]+)\\..*"
55         target_label: instance
56       - target_label: __address__
57         replacement: 127.0.0.1:9219
58 <% @jobs.sort.each do |name, targets| -%>
59   - job_name: <%= name %>
60 <% if targets.first[:scrape_interval] -%>
61     scrape_interval: <%= targets.first[:scrape_interval] %>
62 <% end -%>
63 <% if targets.first[:scrape_timeout] -%>
64     scrape_timeout: <%= targets.first[:scrape_timeout] %>
65 <% end -%>
66 <% if targets.first[:sni] -%>
67     tls_config:
68       server_name: <%= targets.first[:sni] %>
69     relabel_configs:
70       - target_label: __scheme__
71         replacement: https
72 <% end -%>
73     static_configs:
74 <% targets.each do |target| -%>
75       - targets:
76           - "<%= target[:address] %>"
77         labels:
78           instance: <%= target[:instance] %>
79 <% end -%>
80     metric_relabel_configs:
81 <% targets.each do |target| -%>
82 <% target[:metric_relabel].each do |relabel| -%>
83       - source_labels: [instance,<%= relabel[:source_labels] %>]
84         regex: "<%= target[:instance] %>;<%= relabel[:regex] %>"
85         action: <%= relabel[:action] %>
86 <% end -%>
87 <% end -%>
88 <% end -%>
89   - job_name: snmp
90     scrape_interval: 5m
91     scrape_timeout: 2m
92     metrics_path: /snmp
93     static_configs:
94 <% @snmp_targets.sort_by { |t| t[:instance] }.each do |target| -%>
95       - targets:
96 <% target[:modules].each do |module_name| -%>
97           - "<%= target[:target] %>/<%= module_name %>/<%= target[:address] %>"
98 <% end -%>
99         labels:
100           instance: <%= target[:instance] %>
101 <% target[:labels].sort.each do |name, value| -%>
102           <%= name %>: <%= value %>
103 <% end -%>
104 <% end -%>
105     relabel_configs:
106       - source_labels: [__address__]
107         regex: "([^/]+)/[^/]+/.*"
108         target_label: __param_target
109       - source_labels: [__address__]
110         regex: "[^/]+/([^/]+)/.*"
111         target_label: __param_module
112       - source_labels: [__address__]
113         regex: "[^/]+/([^/]+)/.*"
114         target_label: module
115       - source_labels: [__address__]
116         regex: "[^/]+/[^/]+/(.*)"
117         target_label: __address__
118
119 remote_write:
120   - url: "http://localhost:9201/write"
121     write_relabel_configs:
122       - source_labels: [__name__]
123         regex: "go_.*"
124         action: drop
125       - source_labels: [__name__]
126         regex: "promhttp_.*"
127         action: drop
128     queue_config:
129       capacity: 10000
130       min_shards: 4
131       batch_send_deadline: 30s
132       max_backoff: 1s
133
134 remote_read:
135   - url: "http://localhost:9201/read"