]> git.openstreetmap.org Git - chef.git/blob - cookbooks/prometheus/templates/default/alert_rules.yml.erb
Adjust sandbox for otrs service
[chef.git] / cookbooks / prometheus / templates / default / alert_rules.yml.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 groups:
4   - name: alertmanager
5     rules:
6       - alert: prometheus target missing
7         expr: up == 0
8         for: 5m
9         labels:
10           alertgroup: "prometheus"
11   - name: apache
12     rules:
13       - alert: apache down
14         expr: apache_up == 0
15         for: 5m
16         labels:
17           alertgroup: "{{ $labels.instance }}"
18       - alert: apache workers busy
19         expr: sum(apache_workers{state="busy"}) by (instance) / sum(apache_scoreboard) by (instance) > 0.8
20         for: 5m
21         labels:
22           alertgroup: "{{ $labels.instance }}"
23         annotations:
24           busy_workers: "{{ $value | humanizePercentage }}"
25   - name: cpu
26     rules:
27       - alert: cpu pressure
28         expr: rate(node_pressure_cpu_waiting_seconds_total[5m]) > 0.3
29         for: 15m
30         labels:
31           alertgroup: "{{ $labels.instance }}"
32         annotations:
33           pressure: "{{ $value | humanizePercentage }}"
34   - name: database
35     rules:
36       - alert: postgres replication delay
37         expr: pg_replication_lag_seconds > 5
38         for: 5m
39         labels:
40           alertgroup: database
41         annotations:
42           delay: "{{ $value | humanizeDuration }}"
43   - name: fastly
44     rules:
45       - alert: error rate
46         expr: sum(rate(fastly_rt_status_group_total{status_group="5xx"}[5m])) by (service_name, datacenter) / sum(rate(fastly_rt_status_group_total[5m])) by (service_name, datacenter) > 0.005
47         for: 15m
48         labels:
49           alertgroup: fastly
50         annotations:
51           error_rate: "{{ $value | humanizePercentage }}"
52   - name: filesystem
53     rules:
54       - alert: readonly filesystem
55         expr: node_filesystem_readonly == 1
56         for: 0m
57         labels:
58           alertgroup: "{{ $labels.instance }}"
59       - alert: filesystem low on space
60         expr: node_filesystem_avail_bytes / node_filesystem_size_bytes < 0.05
61         for: 5m
62         labels:
63           alertgroup: "{{ $labels.instance }}"
64         annotations:
65           percentage_free: "{{ $value | humanizePercentage }}"
66           free_bytes: "{{ with printf \"node_filesystem_avail_bytes{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value | humanize1024 }}bytes{{end}}"
67           total_total: "{{ with printf \"node_filesystem_size_bytes{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value | humanize1024 }}bytes{{end}}"
68       - alert: filesystem low on inodes
69         expr: node_filesystem_files_free / node_filesystem_files < 0.1
70         for: 5m
71         labels:
72           alertgroup: "{{ $labels.instance }}"
73         annotations:
74           percentage_free: "{{ $value | humanizePercentage }}"
75           free_inodes: "{{ with printf \"node_filesystem_files_free{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value }}{{end}}"
76           total_inodes: "{{ with printf \"node_filesystem_files{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value }}{{end}}"
77   - name: hwmon
78     rules:
79       - alert: hwmon fan alarm
80         expr: node_hwmon_fan_alarm == 1
81         for: 5m
82         labels:
83           alertgroup: "{{ $labels.instance }}"
84         annotations:
85           fan_rpm: "{{ with printf \"node_hwmon_fan_rpm{instance='%s',chip='%s',sensor='%s'}\" $labels.instance $labels.chip $labels.sensor | query }}{{ . | first | value | humanize }}rpm{{end}}"
86           fan_min_rpm: "{{ with printf \"node_hwmon_fan_min_rpm{instance='%s',chip='%s',sensor='%s'}\" $labels.instance $labels.chip $labels.sensor | query }}{{ . | first | value | humanize }}rpm{{end}}"
87       - alert: hwmon temperature alarm
88         expr: node_hwmon_temp_alarm == 1
89         for: 5m
90         labels:
91           alertgroup: "{{ $labels.instance }}"
92         annotations:
93           temp_celsius: "{{ with printf \"node_hwmon_temp_celsius{instance='%s',chip='%s',sensor='%s'}\" $labels.instance $labels.chip $labels.sensor | query }}{{ . | first | value | humanize }}C{{end}}"
94           temp_max_celsius: "{{ with printf \"node_hwmon_temp_max_celsius{instance='%s',chip='%s',sensor='%s'}\" $labels.instance $labels.chip $labels.sensor | query }}{{ . | first | value | humanize }}C{{end}}"
95           temp_crit_celsius: "{{ with printf \"node_hwmon_temp_crit_celsius{instance='%s',chip='%s',sensor='%s'}\" $labels.instance $labels.chip $labels.sensor | query }}{{ . | first | value | humanize }}C{{end}}"
96       - alert: hwmon voltage alarm
97         expr: node_hwmon_in_alarm == 1
98         for: 5m
99         labels:
100           alertgroup: "{{ $labels.instance }}"
101         annotations:
102           in_volts: "{{ with printf \"node_hwmon_in_volts{instance='%s',chip='%s',sensor='%s'}\" $labels.instance $labels.chip $labels.sensor | query }}{{ . | first | value | humanize }}V{{end}}"
103           in_min_volts: "{{ with printf \"node_hwmon_in_min_volts{instance='%s',chip='%s',sensor='%s'}\" $labels.instance $labels.chip $labels.sensor | query }}{{ . | first | value | humanize }}V{{end}}"
104           in_max_volts: "{{ with printf \"node_hwmon_in_max_volts{instance='%s',chip='%s',sensor='%s'}\" $labels.instance $labels.chip $labels.sensor | query }}{{ . | first | value | humanize }}V{{end}}"
105   - name: io
106     rules:
107       - alert: io pressure
108         expr: rate(node_pressure_io_waiting_seconds_total[5m]) > 0.6
109         for: 60m
110         labels:
111           alertgroup: "{{ $labels.instance }}"
112         annotations:
113           pressure: "{{ $value | humanizePercentage }}"
114   - name: ipmi
115     rules:
116       - alert: ipmi fan alarm
117         expr: ipmi_fan_speed_state > 0
118         for: 5m
119         labels:
120           alertgroup: "{{ $labels.instance }}"
121         annotations:
122           fan_speed_rpm: "{{ with printf \"ipmi_fan_speed_rpm{instance='%s',id='%s'}\" $labels.instance $labels.id | query }}{{ . | first | value | humanize }}rpm{{end}}"
123       - alert: ipmi temperature alarm
124         expr: ipmi_temperature_state > 0
125         for: 5m
126         labels:
127           alertgroup: "{{ $labels.instance }}"
128         annotations:
129           temperature_celsius: "{{ with printf \"ipmi_temperature_celsius{instance='%s',id='%s'}\" $labels.instance $labels.id | query }}{{ . | first | value | humanize }}C{{end}}"
130       - alert: ipmi voltage alarm
131         expr: ipmi_voltage_state > 0
132         for: 5m
133         labels:
134           alertgroup: "{{ $labels.instance }}"
135         annotations:
136           voltage_volts: "{{ with printf \"ipmi_voltage_volts{instance='%s',id='%s'}\" $labels.instance $labels.id | query }}{{ . | first | value | humanize }}V{{end}}"
137       - alert: ipmi power alarm
138         expr: ipmi_power_state > 0 or ipmi_sensor_state{type=~"Power .*"} > 0
139         for: 5m
140         labels:
141           alertgroup: "{{ $labels.instance }}"
142   - name: mail
143     rules:
144       - alert: exim queue length
145         expr: exim_queue > exim_queue_limit
146         for: 60m
147         labels:
148           alertgroup: mail
149         annotations:
150           queue_length: "{{ $value }}"
151       - alert: mailman queue length
152         expr: mailman_queue_length > 200
153         for: 60m
154         labels:
155           alertgroup: mail
156         annotations:
157           queue_length: "{{ $value }}"
158   - name: mdadm
159     rules:
160       - alert: mdadm array inactive
161         expr: node_md_state{state="inactive"} > 0
162         for: 0m
163         labels:
164           alertgroup: "{{ $labels.instance }}"
165         annotations:
166           required: "{{ with printf \"node_md_disks_required{instance='%s',device='%s'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
167           active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
168           failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
169           spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
170       - alert: mdadm array degraded
171         expr: sum (node_md_disks{state="active"}) without (state) < node_md_disks_required
172         for: 0m
173         labels:
174           alertgroup: "{{ $labels.instance }}"
175         annotations:
176           required: "{{ with printf \"node_md_disks_required{instance='%s',device='%s'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
177           active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
178           failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
179           spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
180       - alert: mdadm disk failed
181         expr: node_md_disks{state="failed"} > 0
182         for: 0m
183         labels:
184           alertgroup: "{{ $labels.instance }}"
185         annotations:
186           required: "{{ with printf \"node_md_disks_required{instance='%s',device='%s'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
187           active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
188           failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
189           spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
190   - name: memory
191     rules:
192       - alert: low memory
193         expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes < 0.1
194         for: 15m
195         labels:
196           alertgroup: "{{ $labels.instance }}"
197         annotations:
198           memory_free: "{{ $value | humanizePercentage }}"
199       - alert: memory pressure
200         expr: rate(node_pressure_memory_waiting_seconds_total[5m]) > 0.6
201         for: 60m
202         labels:
203           alertgroup: "{{ $labels.instance }}"
204         annotations:
205           pressure: "{{ $value | humanizePercentage }}"
206       - alert: oom kill detected
207         expr: increase(node_vmstat_oom_kill[1m]) > 0
208         for: 0m
209         labels:
210           alertgroup: "{{ $labels.instance }}"
211         annotations:
212           new_oom_kills: "{{ $value }}"
213   - name: network
214     rules:
215       - alert: interface transmit rate
216         expr: rate(node_network_transmit_bytes_total[1m]) / node_network_speed_bytes > 0.98
217         for: 5m
218         labels:
219           alertgroup: "{{ $labels.instance }}"
220         annotations:
221           bandwidth_used: "{{ $value | humanizePercentage }}"
222       - alert: interface receive rate
223         expr: rate(node_network_receive_bytes_total[1m]) / node_network_speed_bytes > 0.98
224         for: 5m
225         labels:
226           alertgroup: "{{ $labels.instance }}"
227         annotations:
228           bandwidth_used: "{{ $value | humanizePercentage }}"
229       - alert: interface transmit errors
230         expr: rate(node_network_transmit_errs_total[1m]) / rate(node_network_transmit_packets_total[1m]) > 0.01
231         for: 5m
232         labels:
233           alertgroup: "{{ $labels.instance }}"
234         annotations:
235           error_rate: "{{ $value | humanizePercentage }}"
236       - alert: interface receive errors
237         expr: rate(node_network_receive_errs_total[1m]) / rate(node_network_receive_packets_total[1m]) > 0.01
238         for: 5m
239         labels:
240           alertgroup: "{{ $labels.instance }}"
241         annotations:
242           error_rate: "{{ $value | humanizePercentage }}"
243       - alert: conntrack entries
244         expr: node_nf_conntrack_entries / node_nf_conntrack_entries_limit > 0.8
245         for: 5m
246         labels:
247           alertgroup: "{{ $labels.instance }}"
248         annotations:
249           entries_used: "{{ $value | humanizePercentage }}"
250   - name: planet
251     rules:
252       - alert: planet dump overdue
253         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/(pbf|planet)/.*"} > 7 * 86400 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
254         for: 24h
255         labels:
256           alertgroup: planet
257         annotations:
258           overdue_by: "{{ $value | humanizeDuration }}"
259       - alert: notes dump overdue
260         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/notes/.*"} > 86400 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
261         for: 6h
262         labels:
263           alertgroup: planet
264         annotations:
265           overdue_by: "{{ $value | humanizeDuration }}"
266       - alert: daily replication feed delayed
267         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/day/.*"} > 86400 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
268         for: 3h
269         labels:
270           alertgroup: planet
271         annotations:
272           delayed_by: "{{ $value | humanizeDuration }}"
273       - alert: hourly replication feed delayed
274         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/hour/.*"} > 3600 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
275         for: 30m
276         labels:
277           alertgroup: planet
278         annotations:
279           delayed_by: "{{ $value | humanizeDuration }}"
280       - alert: minutely replication feed delayed
281         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/minute/.*"} > 60 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
282         for: 5m
283         labels:
284           alertgroup: planet
285         annotations:
286           delayed_by: "{{ $value | humanizeDuration }}"
287       - alert: changeset replication feed delayed
288         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/changesets/.*"} > 60 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
289         for: 5m
290         labels:
291           alertgroup: planet
292         annotations:
293           delayed_by: "{{ $value | humanizeDuration }}"
294   - name: postgresql
295     rules:
296       - alert: postgresql down
297         expr: pg_up == 0
298         for: 1m
299         labels:
300           alertgroup: "{{ $labels.instance }}"
301       - alert: postgresql replication delay
302         expr: pg_replication_lag_seconds > 5
303         for: 1m
304         labels:
305           alertgroup: "{{ $labels.instance }}"
306         annotations:
307           delay: "{{ $value | humanizeDuration }}"
308       - alert: postgresql connection limit
309         expr: sum (pg_stat_activity_count) by (instance, server) / sum (pg_settings_max_connections) by (instance, server) > 0.8
310         for: 1m
311         labels:
312           alertgroup: "{{ $labels.instance }}"
313         annotations:
314           connections_used: "{{ $value | humanizePercentage }}"
315       - alert: postgresql deadlocks
316         expr: increase(pg_stat_database_deadlocks[1m]) > 5
317         for: 0m
318         labels:
319           alertgroup: "{{ $labels.instance }}"
320         annotations:
321           new_deadlocks: "{{ $value }}"
322       - alert: postgresql slow queries
323         expr: pg_slow_queries > 0
324         for: 5m
325         labels:
326           alertgroup: "{{ $labels.instance }}"
327         annotations:
328           queries: "{{ $value }}"
329   - name: smart
330     rules:
331       - alert: smart failure
332         expr: smart_health_status == 0
333         for: 60m
334         labels:
335           alertgroup: "{{ $labels.instance }}"
336       - alert: smart ssd wearout approaching
337         expr: smart_percentage_used >= 90
338         for: 60m
339         labels:
340           alertgroup: "{{ $labels.instance }}"
341         annotations:
342           percentage_used: "{{ $value | humanizePercentage }}"
343   - name: ssl
344     rules:
345       - alert: ssl certificate probe failed
346         expr: ssl_probe_success == 0
347         for: 60m
348         labels:
349           alertgroup: ssl
350       - alert: ssl certificate expiry
351         expr: ssl_verified_cert_not_after{chain_no="0"} - time() < 86400 * 14
352         for: 0m
353         labels:
354           alertgroup: ssl
355         annotations:
356           expires_in: "{{ $value | humanizeDuration }}"
357       - alert: ssl certificate revoked
358         expr: ssl_ocsp_response_status == 1
359         for: 0m
360         labels:
361           alertgroup: ssl
362       - alert: ocsp status unknown
363         expr: ssl_ocsp_response_status == 1
364         for: 0m
365         labels:
366           alertgroup: ssl
367   - name: systemd
368     rules:
369       - alert: systemd failed service
370         expr: node_systemd_unit_state{state="failed"} == 1
371         for: 5m
372         labels:
373           alertgroup: "{{ $labels.instance }}"
374   - name: tile
375     rules:
376       - alert: renderd replication delay
377         expr: renderd_replication_delay > 120
378         for: 5m
379         labels:
380           alertgroup: tile
381         annotations:
382           delay: "{{ $value | humanizeDuration }}"
383       - alert: missed tile rate
384         expr: sum(rate(modtile_http_response_total{code="404"}[5m])) by (instance) / sum(rate(modtile_http_response_total[5m])) by (instance) > 0.05
385         for: 5m
386         labels:
387           alertgroup: tile
388         annotations:
389           miss_rate: "{{ $value | humanizePercentage }}"
390   - name: time
391     rules:
392       - alert: clock not synchronising
393         expr: min_over_time(node_timex_sync_status[1m]) == 0 and node_timex_maxerror_seconds >= 16
394         for: 5m
395         labels:
396           alertgroup: "{{ $labels.instance }}"
397       - alert: clock skew detected
398         expr: (node_timex_offset_seconds > 0.05 and deriv(node_timex_offset_seconds[5m]) >= 0) or (node_timex_offset_seconds < -0.05 and deriv(node_timex_offset_seconds[5m]) <= 0)
399         for: 5m
400         labels:
401           alertgroup: "{{ $labels.instance }}"
402         annotations:
403           skew: "{{ with printf \"node_timex_offset_seconds{instance='%s'}\" $labels.instance | query }} {{ . | humanizeDuration }}{{ end }}"
404   - name: web
405     rules:
406       - alert: web error rate
407         expr: sum(rate(api_call_count_total{status=~"50[0-8]|5[1-9][0-9]"}[5m])) by (instance) / sum(rate(api_call_count_total[5m])) by (instance) > 0.002
408         for: 5m
409         labels:
410           alertgroup: web
411         annotations:
412           error_rate: "{{ $value | humanizePercentage }}"
413       - alert: job processing rate
414         expr: rate(pg_stat_user_tables_n_tup_del{datname="openstreetmap",relname="delayed_jobs"}[5m]) / rate(pg_stat_user_tables_n_tup_ins{datname="openstreetmap",relname="delayed_jobs"}[5m]) < 0.9 and ignoring(job, name, datname, relname, schemaname, server) chef_role{name="db-master"} == 1
415         for: 5m
416         labels:
417           alertgroup: web
418         annotations:
419           job_processing_rate: "{{ $value | humanizePercentage }}"