]> git.openstreetmap.org Git - chef.git/blob - cookbooks/prometheus/templates/default/alert_rules.yml.erb
vectortile: track osm2pgsql db age
[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: amsterdam
5     rules:
6       - alert: uplink
7         expr: junos_interface_up{site="amsterdam",name=~"ge-[01]/2/2"} != 1
8         for: 6m
9         labels:
10           alertgroup: "amsterdam"
11         annotations:
12           status: "{{ $value }}"
13       - alert: pdu current draw
14         expr: rPDU2PhaseStatusCurrent{site="amsterdam",rPDU2PhaseStatusIndex="1"} / 10 > 28
15         for: 6m
16         labels:
17           alertgroup: "amsterdam"
18         annotations:
19           current: "{{ $value | humanize }}A"
20       - alert: site power
21         expr: sum(avg_over_time(rPDU2PhaseStatusApparentPower{site="amsterdam",rPDU2PhaseStatusIndex="1"}[1h]) / 100) > 3.5
22         for: 6m
23         labels:
24           alertgroup: "amsterdam"
25         annotations:
26           current: "{{ $value | humanize }}kVA"
27       - alert: site temperature
28         expr: min(rPDU2SensorTempHumidityStatusTempC{site="amsterdam"}) / 10 < 15 or min(rPDU2SensorTempHumidityStatusTempC{site="amsterdam"}) / 10 > 32
29         for: 6m
30         labels:
31           alertgroup: "amsterdam"
32         annotations:
33           temperature: "{{ $value | humanize }}C"
34       - alert: site humidity
35         expr: max(rPDU2SensorTempHumidityStatusRelativeHumidity{site="amsterdam"}) / 100 < 0.08 or max(rPDU2SensorTempHumidityStatusRelativeHumidity{site="amsterdam"}) / 100 > 0.8
36         for: 6m
37         labels:
38           alertgroup: "amsterdam"
39         annotations:
40           humidity: "{{ $value | humanizePercentage }}"
41   - name: apache
42     rules:
43       - alert: apache down
44         expr: apache_up == 0
45         for: 5m
46         labels:
47           alertgroup: "{{ $labels.instance }}"
48       - alert: apache workers busy
49         expr: sum(apache_workers{state="busy"}) by (instance) / sum(apache_scoreboard) by (instance) > 0.8
50         for: 5m
51         labels:
52           alertgroup: "{{ $labels.instance }}"
53         annotations:
54           busy_workers: "{{ $value | humanizePercentage }}"
55       - alert: apache connection limit
56         expr: (apache_connections{state="total"} - on (instance) apache_connections{state="closing"}) / on (instance) (apache_server_limit * on (instance) (apache_threads_per_child + on (instance) (apache_async_request_worker_factor * on (instance) apache_workers{state="idle"} / on(instance) apache_processes{state="all"}))) > 0.8
57         for: 5m
58         labels:
59           alertgroup: "{{ $labels.instance }}"
60         annotations:
61           connections: "{{ $value | humanizePercentage }}"
62   - name: chef
63     rules:
64       - alert: chef client not running
65         expr: time() - node_systemd_timer_last_trigger_seconds{name="chef-client.timer"} > 3600
66         for: 12h
67         labels:
68           alertgroup: "{{ $labels.instance }}"
69         annotations:
70           down_time: "{{ $value | humanizeDuration }}"
71   - name: cisco
72     rules:
73       - alert: cisco fan alarm
74         expr: rlPhdUnitEnvParamFan1Status{rlPhdUnitEnvParamFan1Status!="normal"} > 0 or rlPhdUnitEnvParamFan2Status{rlPhdUnitEnvParamFan2Status!="normal"} > 0
75         for: 5m
76         labels:
77           alertgroup: "{{ $labels.site }}"
78         annotations:
79           fan_rpm: "{{ with printf \"rlPhdUnitEnvParamFan1Speed{site='%s',instance='%s',rlPhdUnitEnvParamStackUnit='%s'}\" $labels.site $labels.instance $labels.rlPhdUnitEnvParamStackUnit | query }}{{ . | first | value | humanize }}rpm{{end}}"
80       - alert: cisco temperature alarm
81         expr: rlPhdUnitEnvParamTempSensorStatus{rlPhdUnitEnvParamTempSensorStatus!="ok"} > 0
82         for: 5m
83         labels:
84           alertgroup: "{{ $labels.site }}"
85         annotations:
86           temp_celsius: "{{ with printf \"rlPhdUnitEnvParamTempSensorValue{site='%s',instance='%s',rlPhdUnitEnvParamStackUnit='%s'}\" $labels.site $labels.instance $labels.rlPhdUnitEnvParamStackUnit | query }}{{ . | first | value | humanize }}C{{end}}"
87       - alert: cisco main power alarm
88         expr: rlPhdUnitEnvParamMainPSStatus{rlPhdUnitEnvParamMainPSStatus!="normal"} > 0
89         for: 5m
90         labels:
91           alertgroup: "{{ $labels.site }}"
92       - alert: cisco redundant power alarm
93         expr: rlPhdUnitEnvParamRedundantPSStatus{rlPhdUnitEnvParamRedundantPSStatus!="normal"} > 0
94         for: 5m
95         labels:
96           alertgroup: "{{ $labels.site }}"
97   - name: cpu
98     rules:
99       - alert: cpu pressure
100         expr: rate(node_pressure_cpu_waiting_seconds_total[5m]) > 0.75
101         for: 60m
102         labels:
103           alertgroup: "{{ $labels.instance }}"
104         annotations:
105           pressure: "{{ $value | humanizePercentage }}"
106   - name: database
107     rules:
108       - alert: active rails queries
109         expr: sum(pg_stat_activity_count{datname="openstreetmap",usename="rails",state="active"}) by (instance) > 50 and on (instance) chef_role{name="db-master"}
110         for: 5m
111         labels:
112           alertgroup: database
113         annotations:
114           queries: "{{ $value }}"
115       - alert: active cgimap queries
116         expr: sum(pg_stat_activity_count{datname="openstreetmap",usename="cgimap",state="active"}) by (instance) > 30 and on (instance) chef_role{name="db-master"}
117         for: 5m
118         labels:
119           alertgroup: database
120         annotations:
121           queries: "{{ $value }}"
122   - name: discourse
123     rules:
124       - alert: discourse job failure rate
125         expr: rate(discourse_job_failures[5m]) > 0
126         for: 5m
127         labels:
128           alertgroup: discourse
129         annotations:
130           failure_rate: "{{ $value }} jobs/s"
131   - name: dublin
132     rules:
133       - alert: uplink
134         expr: junos_interface_up{site="dublin",name=~"ge-[01]/2/2"} != 1
135         for: 6m
136         labels:
137           alertgroup: "dublin"
138         annotations:
139           status: "{{ $value }}"
140       - alert: pdu current draw
141         expr: rPDU2PhaseStatusCurrent{site="dublin",rPDU2PhaseStatusIndex="1"} / 10 > 28
142         for: 6m
143         labels:
144           alertgroup: "dublin"
145         annotations:
146           current: "{{ $value | humanize }}A"
147       - alert: site power
148         expr: sum(avg_over_time(rPDU2PhaseStatusApparentPower{site="dublin",rPDU2PhaseStatusIndex="1"}[1h]) / 100) > 4
149         for: 6m
150         labels:
151           alertgroup: "dublin"
152         annotations:
153           current: "{{ $value | humanize }}kVA"
154       - alert: site temperature
155         expr: min(rPDU2SensorTempHumidityStatusTempC{site="dublin"}) / 10 < 18 or min(rPDU2SensorTempHumidityStatusTempC{site="dublin"}) / 10 > 26
156         for: 6m
157         labels:
158           alertgroup: "dublin"
159         annotations:
160           temperature: "{{ $value | humanize }}C"
161       - alert: site humidity
162         expr: max(rPDU2SensorTempHumidityStatusRelativeHumidity{site="dublin"}) / 100 < 0.25 or max(rPDU2SensorTempHumidityStatusRelativeHumidity{site="dublin"}) / 100 > 0.65
163         for: 6m
164         labels:
165           alertgroup: "dublin"
166         annotations:
167           humidity: "{{ $value | humanizePercentage }}"
168   - name: fastly
169     rules:
170       - alert: fastly error rate
171         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
172         for: 15m
173         labels:
174           alertgroup: fastly
175         annotations:
176           error_rate: "{{ $value | humanizePercentage }}"
177       - alert: fastly frontend healthcheck warning
178         expr: count(fastly_healthcheck_status == 0) by (service, datacenter) > 2
179         for: 15m
180         labels:
181           alertgroup: fastly
182       - alert: fastly frontend healthcheck critical
183         expr: count(fastly_healthcheck_status == 0) by (service, datacenter) == count(fastly_healthcheck_status) by (service, datacenter)
184         for: 5m
185         labels:
186           alertgroup: fastly
187       - alert: fastly backend healthcheck warning
188         expr: count(fastly_healthcheck_status == 0) by (service, backend) > 10
189         for: 15m
190         labels:
191           alertgroup: fastly
192       - alert: fastly backend healthcheck critical
193         expr: count(fastly_healthcheck_status == 0) by (service, backend) == count(fastly_healthcheck_status) by (service, backend)
194         for: 5m
195         labels:
196           alertgroup: fastly
197   - name: filesystem
198     rules:
199       - alert: readonly filesystem
200         expr: node_filesystem_readonly > min_over_time(node_filesystem_readonly[7d])
201         for: 0m
202         labels:
203           alertgroup: "{{ $labels.instance }}"
204       - alert: filesystem low on space
205         expr: node_filesystem_avail_bytes / node_filesystem_size_bytes < 0.05
206         for: 5m
207         labels:
208           alertgroup: "{{ $labels.instance }}"
209         annotations:
210           percentage_free: "{{ $value | humanizePercentage }}"
211           free_bytes: "{{ with printf \"node_filesystem_avail_bytes{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value | humanize1024 }}bytes{{end}}"
212           total_total: "{{ with printf \"node_filesystem_size_bytes{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value | humanize1024 }}bytes{{end}}"
213       - alert: filesystem low on inodes
214         expr: node_filesystem_files_free / node_filesystem_files < 0.1
215         for: 5m
216         labels:
217           alertgroup: "{{ $labels.instance }}"
218         annotations:
219           percentage_free: "{{ $value | humanizePercentage }}"
220           free_inodes: "{{ with printf \"node_filesystem_files_free{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value }}{{end}}"
221           total_inodes: "{{ with printf \"node_filesystem_files{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value }}{{end}}"
222   - name: hwmon
223     rules:
224       - alert: hwmon fan alarm
225         expr: node_hwmon_fan_alarm == 1
226         for: 5m
227         labels:
228           alertgroup: "{{ $labels.instance }}"
229         annotations:
230           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}}"
231           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}}"
232       - alert: hwmon temperature alarm
233         expr: node_hwmon_temp_alarm == 1
234         for: 5m
235         labels:
236           alertgroup: "{{ $labels.instance }}"
237         annotations:
238           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}}"
239           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}}"
240           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}}"
241       - alert: hwmon voltage alarm
242         expr: node_hwmon_in_alarm == 1
243         for: 5m
244         labels:
245           alertgroup: "{{ $labels.instance }}"
246         annotations:
247           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}}"
248           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}}"
249           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}}"
250   - name: io
251     rules:
252       - alert: io pressure
253         expr: rate(node_pressure_io_waiting_seconds_total[5m]) > 0.6
254         for: 60m
255         labels:
256           alertgroup: "{{ $labels.instance }}"
257         annotations:
258           pressure: "{{ $value | humanizePercentage }}"
259   - name: ipmi
260     rules:
261       - alert: ipmi fan alarm
262         expr: ipmi_fan_speed_state > 0
263         for: 5m
264         labels:
265           alertgroup: "{{ $labels.instance }}"
266         annotations:
267           fan_speed_rpm: "{{ with printf \"ipmi_fan_speed_rpm{instance='%s',id='%s'}\" $labels.instance $labels.id | query }}{{ . | first | value | humanize }}rpm{{end}}"
268       - alert: ipmi temperature alarm
269         expr: ipmi_temperature_state > 0
270         for: 5m
271         labels:
272           alertgroup: "{{ $labels.instance }}"
273         annotations:
274           temperature_celsius: "{{ with printf \"ipmi_temperature_celsius{instance='%s',id='%s'}\" $labels.instance $labels.id | query }}{{ . | first | value | humanize }}C{{end}}"
275       - alert: ipmi voltage alarm
276         expr: ipmi_voltage_state > 0
277         for: 5m
278         labels:
279           alertgroup: "{{ $labels.instance }}"
280         annotations:
281           voltage_volts: "{{ with printf \"ipmi_voltage_volts{instance='%s',id='%s'}\" $labels.instance $labels.id | query }}{{ . | first | value | humanize }}V{{end}}"
282       - alert: ipmi power alarm
283         expr: ipmi_power_state > 0 or ipmi_sensor_state{type=~"Power .*"} > 0
284         for: 5m
285         labels:
286           alertgroup: "{{ $labels.instance }}"
287   - name: juniper
288     rules:
289       - alert: juniper red alarms
290         expr: juniper_alarms_red_count > 0
291         for: 5m
292         labels:
293           alertgroup: "{{ $labels.site }}"
294         annotations:
295           alarm_count: "{{ $value }} alarms"
296       - alert: juniper yellow alarms
297         expr: juniper_alarms_yellow_count > 0
298         for: 5m
299         labels:
300           alertgroup: "{{ $labels.site }}"
301         annotations:
302           alarm_count: "{{ $value }} alarms"
303       - alert: juniper cpu alarm
304         expr: junos_route_engine_load_average_five / 2 > 0.5
305         for: 5m
306         labels:
307           alertgroup: "{{ $labels.site }}"
308         annotations:
309           load_average: "{{ $value | humanizePercentage }}"
310       - alert: juniper fan alarm
311         expr: junos_environment_fan_up != 1
312         for: 5m
313         labels:
314           alertgroup: "{{ $labels.site }}"
315       - alert: juniper power alarm
316         expr: junos_environment_power_up != 1
317         for: 5m
318         labels:
319           alertgroup: "{{ $labels.site }}"
320       - alert: juniper laser receive power
321         expr: junos_interface_diagnostics_laser_rx_dbm < -12 and on (site, instance, name) junos_interface_admin_up == 1
322         for: 5m
323         labels:
324           alertgroup: "{{ $labels.site }}"
325         annotations:
326           power: "{{ $value }} dBm"
327       - alert: juniper laser transmit power
328         expr: junos_interface_diagnostics_laser_output_dbm < -8 and on (site, instance, name) junos_interface_admin_up == 1
329         for: 5m
330         labels:
331           alertgroup: "{{ $labels.site }}"
332         annotations:
333           power: "{{ $value }} dBm"
334   - name: load
335     rules:
336       - alert: load average
337         expr: sum(node_load5) by (instance) / count(node_cpu_frequency_max_hertz) by (instance) > 2
338         for: 5m
339         labels:
340           alertgroup: "{{ $labels.instance }}"
341         annotations:
342           load: "{{ $value | humanizePercentage }}"
343   - name: mail
344     rules:
345       - alert: exim down
346         expr: exim_up == 0
347         for: 5m
348         labels:
349           alertgroup: "{{ $labels.instance }}"
350       - alert: exim queue length
351         expr: exim_queue > ignoring(job) exim_queue_limit
352         for: 60m
353         labels:
354           alertgroup: mail
355         annotations:
356           queue_length: "{{ $value }}"
357       - alert: mailman queue length
358         expr: mailman_queue_length > 200
359         for: 60m
360         labels:
361           alertgroup: mail
362         annotations:
363           queue_length: "{{ $value }}"
364   - name: mdadm
365     rules:
366       - alert: mdadm array inactive
367         expr: node_md_state{state="inactive"} > 0
368         for: 0m
369         labels:
370           alertgroup: "{{ $labels.instance }}"
371         annotations:
372           required: "{{ with printf \"node_md_disks_required{instance='%s',device='%s'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
373           active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
374           failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
375           spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
376       - alert: mdadm array degraded
377         expr: sum (node_md_disks{state="active"}) without (state) < node_md_disks_required
378         for: 0m
379         labels:
380           alertgroup: "{{ $labels.instance }}"
381         annotations:
382           required: "{{ with printf \"node_md_disks_required{instance='%s',device='%s'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
383           active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
384           failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
385           spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
386       - alert: mdadm disk failed
387         expr: node_md_disks{state="failed"} > 0
388         for: 0m
389         labels:
390           alertgroup: "{{ $labels.instance }}"
391         annotations:
392           required: "{{ with printf \"node_md_disks_required{instance='%s',device='%s'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
393           active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
394           failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
395           spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
396   - name: memory
397     rules:
398       - alert: low memory
399         expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes < 0.1
400         for: 15m
401         labels:
402           alertgroup: "{{ $labels.instance }}"
403         annotations:
404           memory_free: "{{ $value | humanizePercentage }}"
405       - alert: memory pressure
406         expr: rate(node_pressure_memory_waiting_seconds_total[5m]) > 0.6
407         for: 60m
408         labels:
409           alertgroup: "{{ $labels.instance }}"
410         annotations:
411           pressure: "{{ $value | humanizePercentage }}"
412       - alert: oom kill detected
413         expr: increase(node_vmstat_oom_kill[1m]) > 0
414         for: 0m
415         labels:
416           alertgroup: "{{ $labels.instance }}"
417         annotations:
418           new_oom_kills: "{{ $value }}"
419   - name: mysql
420     rules:
421       - alert: mysql down
422         expr: mysql_up == 0
423         for: 1m
424         labels:
425           alertgroup: "{{ $labels.instance }}"
426       - alert: mysql connection limit
427         expr: mysql_global_status_max_used_connections / mysql_global_variables_max_connections > 0.8
428         for: 1m
429         labels:
430           alertgroup: "{{ $labels.instance }}"
431         annotations:
432           connections_used: "{{ $value | humanizePercentage }}"
433       - alert: mysql connection errors
434         expr: increase(mysql_global_status_connection_errors_total[1m]) > 0
435         for: 0m
436         labels:
437           alertgroup: "{{ $labels.instance }}"
438         annotations:
439           error_count: "{{ $value }}"
440   - name: network
441     rules:
442       - alert: interface redundancy lost
443         expr: node_bonding_active < 2 and on (instance, master) label_replace(chef_network_interface{bond_mode="802.3ad"}, "master", "$1", "name", "(.*)")
444         for: 5m
445         labels:
446           alertgroup: "{{ $labels.instance }}"
447         annotations:
448           link_count: "{{ $value }}"
449       - alert: interface transmit rate
450         expr: rate(node_network_transmit_bytes_total[1m]) / node_network_speed_bytes > 0.99
451         for: 5m
452         labels:
453           alertgroup: "{{ $labels.instance }}"
454         annotations:
455           bandwidth_used: "{{ $value | humanizePercentage }}"
456       - alert: interface receive rate
457         expr: rate(node_network_receive_bytes_total[1m]) / node_network_speed_bytes > 0.99
458         for: 5m
459         labels:
460           alertgroup: "{{ $labels.instance }}"
461         annotations:
462           bandwidth_used: "{{ $value | humanizePercentage }}"
463       - alert: interface transmit errors
464         expr: rate(node_network_transmit_errs_total{device!~"wg.*"}[1m]) / rate(node_network_transmit_packets_total{device!~"wg.*"}[1m]) > 0.01
465         for: 5m
466         labels:
467           alertgroup: "{{ $labels.instance }}"
468         annotations:
469           error_rate: "{{ $value | humanizePercentage }}"
470       - alert: wireguard interface transmit errors
471         expr: rate(node_network_transmit_errs_total{device=~"wg.*"}[1m]) / rate(node_network_transmit_packets_total{device=~"wg.*"}[1m]) > 0.05
472         for: 1h
473         labels:
474           alertgroup: "{{ $labels.instance }}"
475         annotations:
476           error_rate: "{{ $value | humanizePercentage }}"
477       - alert: interface receive errors
478         expr: rate(node_network_receive_errs_total[1m]) / rate(node_network_receive_packets_total[1m]) > 0.01
479         for: 5m
480         labels:
481           alertgroup: "{{ $labels.instance }}"
482         annotations:
483           error_rate: "{{ $value | humanizePercentage }}"
484       - alert: conntrack entries
485         expr: node_nf_conntrack_entries / node_nf_conntrack_entries_limit > 0.8
486         for: 5m
487         labels:
488           alertgroup: "{{ $labels.instance }}"
489         annotations:
490           entries_used: "{{ $value | humanizePercentage }}"
491   - name: nominatim
492     rules:
493       - alert: nominatim replication delay
494         expr: nominatim_replication_delay > 10800
495         for: 1h
496         labels:
497           alertgroup: nominatim
498         annotations:
499           delay: "{{ $value | humanizeDuration }}"
500       - alert: nominatim connections
501         expr: sum(nginx_connections_writing and on (instance) chef_role{name="nominatim"}) > 2500
502         for: 15m
503         labels:
504           alertgroup: nominatim
505   - name: overpass
506     rules:
507       - alert: overpass osm database age
508         expr: overpass_database_age_seconds{database="osm"} > 3600
509         for: 1h
510         labels:
511           alertgroup: overpass
512         annotations:
513           age: "{{ $value | humanizeDuration }}"
514       - alert: overpass area database age
515         expr: overpass_database_age_seconds{database="area"} > 86400
516         for: 1h
517         labels:
518           alertgroup: overpass
519         annotations:
520           age: "{{ $value | humanizeDuration }}"
521   - name: passenger
522     rules:
523       - alert: passenger down
524         expr: passenger_up == 0
525         for: 5m
526         labels:
527           alertgroup: "{{ $labels.instance }}"
528       - alert: passenger queuing
529         expr: passenger_top_level_request_queue > 0
530         for: 5m
531         labels:
532           alertgroup: "{{ $labels.instance }}"
533       - alert: passenger application queuing
534         expr: passenger_app_request_queue > 0
535         for: 5m
536         labels:
537           alertgroup: "{{ $labels.instance }}"
538   - name: planet
539     rules:
540       - alert: planet dump overdue
541         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/(pbf|planet)/.*"} > 7 * 86400 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
542         for: 24h
543         labels:
544           alertgroup: planet
545         annotations:
546           overdue_by: "{{ $value | humanizeDuration }}"
547       - alert: notes dump overdue
548         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/notes/.*"} > 86400 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
549         for: 6h
550         labels:
551           alertgroup: planet
552         annotations:
553           overdue_by: "{{ $value | humanizeDuration }}"
554       - alert: daily replication feed delayed
555         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/day/.*"} > 86400 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
556         for: 3h
557         labels:
558           alertgroup: planet
559         annotations:
560           delayed_by: "{{ $value | humanizeDuration }}"
561       - alert: hourly replication feed delayed
562         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/hour/.*"} > 3600 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
563         for: 30m
564         labels:
565           alertgroup: planet
566         annotations:
567           delayed_by: "{{ $value | humanizeDuration }}"
568       - alert: minutely replication feed delayed
569         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/minute/.*"} > 60 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
570         for: 5m
571         labels:
572           alertgroup: planet
573         annotations:
574           delayed_by: "{{ $value | humanizeDuration }}"
575       - alert: changeset replication feed delayed
576         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/changesets/.*"} > 60 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
577         for: 5m
578         labels:
579           alertgroup: planet
580         annotations:
581           delayed_by: "{{ $value | humanizeDuration }}"
582   - name: postgresql
583     rules:
584       - alert: postgresql down
585         expr: pg_up == 0
586         for: 1m
587         labels:
588           alertgroup: "{{ $labels.instance }}"
589       - alert: postgresql replication delay
590         expr: pg_replication_lag_seconds > 30
591         for: 15m
592         labels:
593           alertgroup: "{{ $labels.instance }}"
594         annotations:
595           delay: "{{ $value | humanizeDuration }}"
596       - alert: postgresql connection limit
597         expr: sum (pg_stat_activity_count) by (instance, server) / sum (pg_settings_max_connections) by (instance, server) > 0.8
598         for: 1m
599         labels:
600           alertgroup: "{{ $labels.instance }}"
601         annotations:
602           connections_used: "{{ $value | humanizePercentage }}"
603       - alert: postgresql deadlocks
604         expr: increase(pg_stat_database_deadlocks{datname!="nominatim"}[1m]) > 5
605         for: 0m
606         labels:
607           alertgroup: "{{ $labels.instance }}"
608         annotations:
609           new_deadlocks: "{{ $value }}"
610       - alert: postgresql idle transactions
611         expr: sum(pg_process_idle_seconds_count{state="idle in transaction"}) by (instance, server) > sum(pg_process_idle_seconds_bucket{state="idle in transaction",le="300"}) by (instance, server)
612         for: 5m
613         labels:
614           alertgroup: "{{ $labels.instance }}"
615         annotations:
616           queries: "{{ $value }}"
617   - name: prometheus
618     rules:
619       - alert: prometheus configuration error
620         expr: prometheus_config_last_reload_successful == 0
621         for: 10m
622         labels:
623           alertgroup: "prometheus"
624       - alert: prometheus target missing
625         expr: up == 0
626         for: 10m
627         labels:
628           alertgroup: "prometheus"
629       - alert: node exporter text file scrape error
630         expr: node_textfile_scrape_error > 0
631         for: 10m
632         labels:
633           alertgroup: "prometheus"
634   - name: raid
635     rules:
636       - alert: raid controller battery failed
637         expr: ohai_controller_info{battery_status="failed"} > 0
638         for: 5m
639         labels:
640           alertgroup: "{{ $labels.instance }}"
641       - alert: raid controller battery recharging
642         expr: ohai_controller_info{battery_status="recharging"} > 0
643         for: 4h
644         labels:
645           alertgroup: "{{ $labels.instance }}"
646       - alert: raid array degraded
647         expr: ohai_array_info{status="degraded"} > 0
648         for: 5m
649         labels:
650           alertgroup: "{{ $labels.instance }}"
651       - alert: raid disk failed
652         expr: ohai_disk_info{status="failed"} > 0
653         for: 5m
654         labels:
655           alertgroup: "{{ $labels.instance }}"
656   - name: rasdaemon
657     rules:
658       - alert: memory controller errors
659         expr: increase(rasdaemon_mc_events_total[1m]) > 0
660         for: 0m
661         labels:
662           alertgroup: "{{ $labels.instance }}"
663         annotations:
664           new_errors: "{{ $value }}"
665       - alert: pcie aer errors
666         expr: increase(rasdaemon_aer_events_total[1m]) > 0
667         for: 0m
668         labels:
669           alertgroup: "{{ $labels.instance }}"
670         annotations:
671           new_errors: "{{ $value }}"
672   - name: smart
673     rules:
674       - alert: smart failure
675         expr: smart_health_status == 0
676         for: 60m
677         labels:
678           alertgroup: "{{ $labels.instance }}"
679       - alert: smart ssd wearout approaching
680         expr: smart_percentage_used / 100 >= 0.8
681         for: 60m
682         labels:
683           alertgroup: "{{ $labels.instance }}"
684         annotations:
685           percentage_used: "{{ $value | humanizePercentage }}"
686   - name: smokeping
687     rules:
688       - alert: packet loss
689         expr: 1 - (rate(smokeping_response_duration_seconds_count[5m]) / rate(smokeping_requests_total[5m])) > 0.02
690         for: 10m
691         labels:
692           alertgroup: smokeping
693         annotations:
694           loss_rate: "{{ $value | humanizePercentage }}"
695   - name: snmp
696     rules:
697       - alert: snmp pdus missing
698         expr: max_over_time(snmp_scrape_pdus_returned[1d]) - snmp_scrape_pdus_returned > 0
699         for: 15m
700         labels:
701           alertgroup: snmp
702         annotations:
703           missing_pdus: "{{ $value }}"
704   - name: ssl
705     rules:
706       - alert: ssl certificate probe failed
707         expr: ssl_probe_success == 0
708         for: 60m
709         labels:
710           alertgroup: ssl
711       - alert: ssl certificate expiry
712         expr: ssl_verified_cert_not_after{chain_no="0"} - time() < 86400 * 14
713         for: 0m
714         labels:
715           alertgroup: ssl
716         annotations:
717           expires_in: "{{ $value | humanizeDuration }}"
718       - alert: ssl certificate revoked
719         expr: ssl_ocsp_response_status == 1
720         for: 0m
721         labels:
722           alertgroup: ssl
723       - alert: ocsp status unknown
724         expr: ssl_ocsp_response_status == 1
725         for: 0m
726         labels:
727           alertgroup: ssl
728   - name: statuscake
729     rules:
730       - alert: statuscake uptime check failing
731         expr: statuscake_paused == 0 and statuscake_up == 0
732         for: 10m
733         labels:
734           alertgroup: statuscake
735   - name: systemd
736     rules:
737       - alert: systemd failed service
738         expr: node_systemd_unit_state{state="failed",name!="chef-client.service"} == 1
739         for: 5m
740         labels:
741           alertgroup: "{{ $labels.instance }}"
742       - alert: systemd failed chef client service
743         expr: sum_over_time(node_systemd_unit_state{state="inactive",name="chef-client.service"}[6h]) == 0
744         for: 0m
745         labels:
746           alertgroup: "{{ $labels.instance }}"
747   - name: taginfo
748     rules:
749       - alert: taginfo planet age
750         expr: time() - taginfo_data_from_seconds > 129600 and on (instance) chef_role{name="taginfo"}
751         for: 0m
752         labels:
753           alertgroup: taginfo
754         annotations:
755           age: "{{ $value | humanizeDuration }}"
756       - alert: taginfo database age
757         expr: time() - taginfo_database_update_finish_seconds > 129600 and on (instance) chef_role{name="taginfo"}
758         for: 0m
759         labels:
760           alertgroup: taginfo
761         annotations:
762           age: "{{ $value | humanizeDuration }}"
763       - alert: taginfo database size
764         expr: abs(delta(taginfo_database_size_bytes[30m])) / taginfo_database_size_bytes > 0.1
765         for: 30m
766         labels:
767           alertgroup: taginfo
768         annotations:
769           size_change: "{{ $value | humanizePercentage }}"
770   - name: tile
771     rules:
772       - alert: renderd replication delay
773         expr: renderd_replication_delay > 120
774         for: 15m
775         labels:
776           alertgroup: tile
777         annotations:
778           delay: "{{ $value | humanizeDuration }}"
779       - alert: missed tile rate
780         expr: sum(rate(modtile_http_response_total{code="404"}[5m])) by (instance) / sum(rate(modtile_http_response_total[5m])) by (instance) > 0.05
781         for: 5m
782         labels:
783           alertgroup: tile
784         annotations:
785           miss_rate: "{{ $value | humanizePercentage }}"
786       - alert: tile render rate
787         expr: sum(rate(renderd_zoom_metatiles_total[5m])) by (instance) == 0
788         for: 15m
789         labels:
790           alertgroup: tile
791         annotations:
792           render_rate: "{{ $value }} tiles/s"
793   - name: time
794     rules:
795       - alert: clock not synchronising
796         expr: min_over_time(node_timex_sync_status[1m]) == 0 and node_timex_maxerror_seconds >= 16
797         for: 5m
798         labels:
799           alertgroup: "{{ $labels.instance }}"
800       - alert: clock skew detected
801         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)
802         for: 5m
803         labels:
804           alertgroup: "{{ $labels.instance }}"
805         annotations:
806           skew: "{{ with printf \"node_timex_offset_seconds{instance='%s'}\" $labels.instance | query }} {{ . | humanizeDuration }}{{ end }}"
807   - name: web
808     rules:
809       - alert: web error rate
810         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 and sum(rate(api_call_count_total{status=~"50[0-8]|5[1-9][0-9]"}[5m])) by (instance) > 0.01
811         for: 5m
812         labels:
813           alertgroup: web
814         annotations:
815           error_rate: "{{ $value | humanizePercentage }}"
816       - alert: job processing rate
817         expr: rate(pg_stat_user_tables_n_tup_del{datname="openstreetmap",relname="delayed_jobs"}[1h]) / rate(pg_stat_user_tables_n_tup_ins{datname="openstreetmap",relname="delayed_jobs"}[1h]) < 0.9 and ignoring(job, name, datname, relname, schemaname, server) chef_role{name="db-master"} == 1
818         for: 1h
819         labels:
820           alertgroup: web
821         annotations:
822           job_processing_rate: "{{ $value | humanizePercentage }}"