]> git.openstreetmap.org Git - chef.git/blob - cookbooks/prometheus/templates/default/alert_rules.yml.erb
Stop remove+add nano looping
[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: pdu current draw
7         expr: rPDU2PhaseStatusCurrent{site="amsterdam",rPDU2PhaseStatusIndex="1"} / 10 > 10
8         for: 5m
9         labels:
10           alertgroup: "amsterdam"
11         annotations:
12           current: "{{ $value | humanize }}A"
13       - alert: site current draw
14         expr: sum(rPDU2PhaseStatusCurrent{site="amsterdam",rPDU2PhaseStatusIndex="1"} / 10) > 13
15         for: 5m
16         labels:
17           alertgroup: "amsterdam"
18         annotations:
19           current: "{{ $value | humanize }}A"
20       - alert: site temperature
21         expr: min(rPDU2SensorTempHumidityStatusTempC{site="amsterdam"}) / 10 < 18 or min(rPDU2SensorTempHumidityStatusTempC{site="amsterdam"}) / 10 > 25
22         for: 5m
23         labels:
24           alertgroup: "amsterdam"
25         annotations:
26           temperature: "{{ $value | humanize }}C"
27       - alert: site humidity
28         expr: max(rPDU2SensorTempHumidityStatusRelativeHumidity{site="amsterdam"}) / 100 < 0.25 or max(rPDU2SensorTempHumidityStatusRelativeHumidity{site="amsterdam"}) / 100 > 0.65
29         for: 5m
30         labels:
31           alertgroup: "amsterdam"
32         annotations:
33           humidity: "{{ $value | humanizePercentage }}"
34   - name: apache
35     rules:
36       - alert: apache down
37         expr: apache_up == 0
38         for: 5m
39         labels:
40           alertgroup: "{{ $labels.instance }}"
41       - alert: apache workers busy
42         expr: sum(apache_workers{state="busy"}) by (instance) / sum(apache_scoreboard) by (instance) > 0.8
43         for: 5m
44         labels:
45           alertgroup: "{{ $labels.instance }}"
46         annotations:
47           busy_workers: "{{ $value | humanizePercentage }}"
48       - alert: apache low request rate
49         expr: rate(apache_accesses_total[5m]) / rate(apache_accesses_total[1h] offset 1w) < 0.25 and rate(apache_accesses_total[1h] offset 1w) > 2
50         for: 15m
51         labels:
52           alertgroup: "{{ $labels.instance }}"
53         annotations:
54           request_rate: "{{ $value | humanizePercentage }}"
55   - name: chef
56     rules:
57       - alert: chef client not running
58         expr: time() - node_systemd_timer_last_trigger_seconds{name="chef-client.timer"} > 3600
59         for: 12h
60         labels:
61           alertgroup: "{{ $labels.instance }}"
62         annotations:
63           down_time: "{{ $value | humanizeDuration }}"
64   - name: cisco
65     rules:
66       - alert: cisco fan alarm
67         expr: rlPhdUnitEnvParamFan1Status{rlPhdUnitEnvParamFan1Status!="normal"} > 0 or rlPhdUnitEnvParamFan2Status{rlPhdUnitEnvParamFan2Status!="normal"} > 0
68         for: 5m
69         labels:
70           alertgroup: "{{ $labels.site }}"
71         annotations:
72           fan_rpm: "{{ with printf \"rlPhdUnitEnvParamFan1Speed{site='%s',instance='%s',rlPhdUnitEnvParamStackUnit='%s'}\" $labels.site $labels.instance $labels.rlPhdUnitEnvParamStackUnit | query }}{{ . | first | value | humanize }}rpm{{end}}"
73       - alert: cisco temperature alarm
74         expr: rlPhdUnitEnvParamTempSensorStatus{rlPhdUnitEnvParamTempSensorStatus!="ok"} > 0
75         for: 5m
76         labels:
77           alertgroup: "{{ $labels.site }}"
78         annotations:
79           temp_celsius: "{{ with printf \"rlPhdUnitEnvParamTempSensorValue{site='%s',instance='%s',rlPhdUnitEnvParamStackUnit='%s'}\" $labels.site $labels.instance $labels.rlPhdUnitEnvParamStackUnit | query }}{{ . | first | value | humanize }}C{{end}}"
80       - alert: cisco main power alarm
81         expr: rlPhdUnitEnvParamMainPSStatus{rlPhdUnitEnvParamMainPSStatus!="normal"} > 0
82         for: 5m
83         labels:
84           alertgroup: "{{ $labels.site }}"
85       - alert: cisco redundant power alarm
86         expr: rlPhdUnitEnvParamRedundantPSStatus{rlPhdUnitEnvParamRedundantPSStatus!="normal"} > 0
87         for: 5m
88         labels:
89           alertgroup: "{{ $labels.site }}"
90   - name: cpu
91     rules:
92       - alert: cpu pressure
93         expr: rate(node_pressure_cpu_waiting_seconds_total[5m]) > 0.6
94         for: 15m
95         labels:
96           alertgroup: "{{ $labels.instance }}"
97         annotations:
98           pressure: "{{ $value | humanizePercentage }}"
99   - name: database
100     rules:
101       - alert: postgres replication delay
102         expr: pg_replication_lag_seconds > 5
103         for: 5m
104         labels:
105           alertgroup: database
106         annotations:
107           delay: "{{ $value | humanizeDuration }}"
108   - name: fastly
109     rules:
110       - alert: fastly error rate
111         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
112         for: 15m
113         labels:
114           alertgroup: fastly
115         annotations:
116           error_rate: "{{ $value | humanizePercentage }}"
117       - alert: fastly healthcheck failing
118         expr: count(fastly_healthcheck_status == 0) > 0
119         for: 15m
120         labels:
121           alertgroup: fastly
122       - alert: fastly healthcheck failing
123         expr: count(fastly_healthcheck_status == 0) > 4
124         for: 5m
125         labels:
126           alertgroup: fastly
127   - name: filesystem
128     rules:
129       - alert: readonly filesystem
130         expr: node_filesystem_readonly == 1
131         for: 0m
132         labels:
133           alertgroup: "{{ $labels.instance }}"
134       - alert: filesystem low on space
135         expr: node_filesystem_avail_bytes / node_filesystem_size_bytes < 0.05
136         for: 5m
137         labels:
138           alertgroup: "{{ $labels.instance }}"
139         annotations:
140           percentage_free: "{{ $value | humanizePercentage }}"
141           free_bytes: "{{ with printf \"node_filesystem_avail_bytes{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value | humanize1024 }}bytes{{end}}"
142           total_total: "{{ with printf \"node_filesystem_size_bytes{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value | humanize1024 }}bytes{{end}}"
143       - alert: filesystem low on inodes
144         expr: node_filesystem_files_free / node_filesystem_files < 0.1
145         for: 5m
146         labels:
147           alertgroup: "{{ $labels.instance }}"
148         annotations:
149           percentage_free: "{{ $value | humanizePercentage }}"
150           free_inodes: "{{ with printf \"node_filesystem_files_free{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value }}{{end}}"
151           total_inodes: "{{ with printf \"node_filesystem_files{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value }}{{end}}"
152   - name: hwmon
153     rules:
154       - alert: hwmon fan alarm
155         expr: node_hwmon_fan_alarm == 1
156         for: 5m
157         labels:
158           alertgroup: "{{ $labels.instance }}"
159         annotations:
160           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}}"
161           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}}"
162       - alert: hwmon temperature alarm
163         expr: node_hwmon_temp_alarm == 1
164         for: 5m
165         labels:
166           alertgroup: "{{ $labels.instance }}"
167         annotations:
168           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}}"
169           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}}"
170           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}}"
171       - alert: hwmon voltage alarm
172         expr: node_hwmon_in_alarm == 1
173         for: 5m
174         labels:
175           alertgroup: "{{ $labels.instance }}"
176         annotations:
177           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}}"
178           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}}"
179           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}}"
180   - name: io
181     rules:
182       - alert: io pressure
183         expr: rate(node_pressure_io_waiting_seconds_total[5m]) > 0.6
184         for: 60m
185         labels:
186           alertgroup: "{{ $labels.instance }}"
187         annotations:
188           pressure: "{{ $value | humanizePercentage }}"
189   - name: ipmi
190     rules:
191       - alert: ipmi fan alarm
192         expr: ipmi_fan_speed_state > 0
193         for: 5m
194         labels:
195           alertgroup: "{{ $labels.instance }}"
196         annotations:
197           fan_speed_rpm: "{{ with printf \"ipmi_fan_speed_rpm{instance='%s',id='%s'}\" $labels.instance $labels.id | query }}{{ . | first | value | humanize }}rpm{{end}}"
198       - alert: ipmi temperature alarm
199         expr: ipmi_temperature_state > 0
200         for: 5m
201         labels:
202           alertgroup: "{{ $labels.instance }}"
203         annotations:
204           temperature_celsius: "{{ with printf \"ipmi_temperature_celsius{instance='%s',id='%s'}\" $labels.instance $labels.id | query }}{{ . | first | value | humanize }}C{{end}}"
205       - alert: ipmi voltage alarm
206         expr: ipmi_voltage_state > 0
207         for: 5m
208         labels:
209           alertgroup: "{{ $labels.instance }}"
210         annotations:
211           voltage_volts: "{{ with printf \"ipmi_voltage_volts{instance='%s',id='%s'}\" $labels.instance $labels.id | query }}{{ . | first | value | humanize }}V{{end}}"
212       - alert: ipmi power alarm
213         expr: ipmi_power_state > 0 or ipmi_sensor_state{type=~"Power .*"} > 0
214         for: 5m
215         labels:
216           alertgroup: "{{ $labels.instance }}"
217   - name: juniper
218     rules:
219       - alert: juniper fan alarm
220         expr: jnxOperatingState{jnxOperatingContentsIndex="4",jnxOperatingState!="running"} > 0
221         for: 5m
222         labels:
223           alertgroup: "{{ $labels.site }}"
224       - alert: juniper power alarm
225         expr: jnxOperatingState{jnxOperatingContentsIndex="2",jnxOperatingState!="running"} > 0
226         for: 5m
227         labels:
228           alertgroup: "{{ $labels.site }}"
229   - name: mail
230     rules:
231       - alert: exim queue length
232         expr: exim_queue > exim_queue_limit
233         for: 60m
234         labels:
235           alertgroup: mail
236         annotations:
237           queue_length: "{{ $value }}"
238       - alert: mailman queue length
239         expr: mailman_queue_length > 200
240         for: 60m
241         labels:
242           alertgroup: mail
243         annotations:
244           queue_length: "{{ $value }}"
245   - name: mdadm
246     rules:
247       - alert: mdadm array inactive
248         expr: node_md_state{state="inactive"} > 0
249         for: 0m
250         labels:
251           alertgroup: "{{ $labels.instance }}"
252         annotations:
253           required: "{{ with printf \"node_md_disks_required{instance='%s',device='%s'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
254           active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
255           failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
256           spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
257       - alert: mdadm array degraded
258         expr: sum (node_md_disks{state="active"}) without (state) < node_md_disks_required
259         for: 0m
260         labels:
261           alertgroup: "{{ $labels.instance }}"
262         annotations:
263           required: "{{ with printf \"node_md_disks_required{instance='%s',device='%s'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
264           active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
265           failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
266           spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
267       - alert: mdadm disk failed
268         expr: node_md_disks{state="failed"} > 0
269         for: 0m
270         labels:
271           alertgroup: "{{ $labels.instance }}"
272         annotations:
273           required: "{{ with printf \"node_md_disks_required{instance='%s',device='%s'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
274           active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
275           failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
276           spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
277   - name: memory
278     rules:
279       - alert: low memory
280         expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes < 0.1
281         for: 15m
282         labels:
283           alertgroup: "{{ $labels.instance }}"
284         annotations:
285           memory_free: "{{ $value | humanizePercentage }}"
286       - alert: memory pressure
287         expr: rate(node_pressure_memory_waiting_seconds_total[5m]) > 0.6
288         for: 60m
289         labels:
290           alertgroup: "{{ $labels.instance }}"
291         annotations:
292           pressure: "{{ $value | humanizePercentage }}"
293       - alert: oom kill detected
294         expr: increase(node_vmstat_oom_kill[1m]) > 0
295         for: 0m
296         labels:
297           alertgroup: "{{ $labels.instance }}"
298         annotations:
299           new_oom_kills: "{{ $value }}"
300   - name: network
301     rules:
302       - alert: interface transmit rate
303         expr: rate(node_network_transmit_bytes_total[1m]) / node_network_speed_bytes > 0.98
304         for: 5m
305         labels:
306           alertgroup: "{{ $labels.instance }}"
307         annotations:
308           bandwidth_used: "{{ $value | humanizePercentage }}"
309       - alert: interface receive rate
310         expr: rate(node_network_receive_bytes_total[1m]) / node_network_speed_bytes > 0.98
311         for: 5m
312         labels:
313           alertgroup: "{{ $labels.instance }}"
314         annotations:
315           bandwidth_used: "{{ $value | humanizePercentage }}"
316       - alert: interface transmit errors
317         expr: rate(node_network_transmit_errs_total{device!~"wg.*"}[1m]) / rate(node_network_transmit_packets_total{device!~"wg.*"}[1m]) > 0.01
318         for: 5m
319         labels:
320           alertgroup: "{{ $labels.instance }}"
321         annotations:
322           error_rate: "{{ $value | humanizePercentage }}"
323       - alert: interface transmit errors
324         expr: rate(node_network_transmit_errs_total{device=~"wg.*"}[1m]) / rate(node_network_transmit_packets_total{device=~"wg.*"}[1m]) > 0.05
325         for: 1h
326         labels:
327           alertgroup: "{{ $labels.instance }}"
328         annotations:
329           error_rate: "{{ $value | humanizePercentage }}"
330       - alert: interface receive errors
331         expr: rate(node_network_receive_errs_total[1m]) / rate(node_network_receive_packets_total[1m]) > 0.01
332         for: 5m
333         labels:
334           alertgroup: "{{ $labels.instance }}"
335         annotations:
336           error_rate: "{{ $value | humanizePercentage }}"
337       - alert: conntrack entries
338         expr: node_nf_conntrack_entries / node_nf_conntrack_entries_limit > 0.8
339         for: 5m
340         labels:
341           alertgroup: "{{ $labels.instance }}"
342         annotations:
343           entries_used: "{{ $value | humanizePercentage }}"
344   - name: planet
345     rules:
346       - alert: planet dump overdue
347         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/(pbf|planet)/.*"} > 7 * 86400 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
348         for: 24h
349         labels:
350           alertgroup: planet
351         annotations:
352           overdue_by: "{{ $value | humanizeDuration }}"
353       - alert: notes dump overdue
354         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/notes/.*"} > 86400 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
355         for: 6h
356         labels:
357           alertgroup: planet
358         annotations:
359           overdue_by: "{{ $value | humanizeDuration }}"
360       - alert: daily replication feed delayed
361         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/day/.*"} > 86400 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
362         for: 3h
363         labels:
364           alertgroup: planet
365         annotations:
366           delayed_by: "{{ $value | humanizeDuration }}"
367       - alert: hourly replication feed delayed
368         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/hour/.*"} > 3600 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
369         for: 30m
370         labels:
371           alertgroup: planet
372         annotations:
373           delayed_by: "{{ $value | humanizeDuration }}"
374       - alert: minutely replication feed delayed
375         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/minute/.*"} > 60 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
376         for: 5m
377         labels:
378           alertgroup: planet
379         annotations:
380           delayed_by: "{{ $value | humanizeDuration }}"
381       - alert: changeset replication feed delayed
382         expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/changesets/.*"} > 60 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
383         for: 5m
384         labels:
385           alertgroup: planet
386         annotations:
387           delayed_by: "{{ $value | humanizeDuration }}"
388   - name: postgresql
389     rules:
390       - alert: postgresql down
391         expr: pg_up == 0
392         for: 1m
393         labels:
394           alertgroup: "{{ $labels.instance }}"
395       - alert: postgresql replication delay
396         expr: pg_replication_lag_seconds > 5
397         for: 1m
398         labels:
399           alertgroup: "{{ $labels.instance }}"
400         annotations:
401           delay: "{{ $value | humanizeDuration }}"
402       - alert: postgresql connection limit
403         expr: sum (pg_stat_activity_count) by (instance, server) / sum (pg_settings_max_connections) by (instance, server) > 0.8
404         for: 1m
405         labels:
406           alertgroup: "{{ $labels.instance }}"
407         annotations:
408           connections_used: "{{ $value | humanizePercentage }}"
409       - alert: postgresql deadlocks
410         expr: increase(pg_stat_database_deadlocks[1m]) > 5
411         for: 0m
412         labels:
413           alertgroup: "{{ $labels.instance }}"
414         annotations:
415           new_deadlocks: "{{ $value }}"
416       - alert: postgresql slow queries
417         expr: pg_slow_queries > 0
418         for: 5m
419         labels:
420           alertgroup: "{{ $labels.instance }}"
421         annotations:
422           queries: "{{ $value }}"
423   - name: prometheus
424     rules:
425       - alert: prometheus configuration error
426         expr: prometheus_config_last_reload_successful == 0
427         for: 10m
428         labels:
429           alertgroup: "prometheus"
430       - alert: prometheus target missing
431         expr: up == 0
432         for: 10m
433         labels:
434           alertgroup: "prometheus"
435   - name: raid
436     rules:
437       - alert: raid array degraded
438         expr: ohai_array_info{status="degraded"} > 0
439         for: 5m
440         labels:
441           alertgroup: "{{ $labels.instance }}"
442       - alert: raid disk failed
443         expr: ohai_disk_info{status="failed"} > 0
444         for: 5m
445         labels:
446           alertgroup: "{{ $labels.instance }}"
447   - name: smart
448     rules:
449       - alert: smart failure
450         expr: smart_health_status == 0
451         for: 60m
452         labels:
453           alertgroup: "{{ $labels.instance }}"
454       - alert: smart ssd wearout approaching
455         expr: smart_percentage_used >= 80
456         for: 60m
457         labels:
458           alertgroup: "{{ $labels.instance }}"
459         annotations:
460           percentage_used: "{{ $value | humanizePercentage }}"
461   - name: ssl
462     rules:
463       - alert: ssl certificate probe failed
464         expr: ssl_probe_success == 0
465         for: 60m
466         labels:
467           alertgroup: ssl
468       - alert: ssl certificate expiry
469         expr: ssl_verified_cert_not_after{chain_no="0"} - time() < 86400 * 14
470         for: 0m
471         labels:
472           alertgroup: ssl
473         annotations:
474           expires_in: "{{ $value | humanizeDuration }}"
475       - alert: ssl certificate revoked
476         expr: ssl_ocsp_response_status == 1
477         for: 0m
478         labels:
479           alertgroup: ssl
480       - alert: ocsp status unknown
481         expr: ssl_ocsp_response_status == 1
482         for: 0m
483         labels:
484           alertgroup: ssl
485   - name: statuscake
486     rules:
487       - alert: statuscake uptime check failing
488         expr: statuscake_uptime{status="down",paused="false"} > 0
489         for: 10m
490         labels:
491           alertgroup: statuscake
492   - name: systemd
493     rules:
494       - alert: systemd failed service
495         expr: node_systemd_unit_state{state="failed",name!="chef-client.service"} == 1
496         for: 5m
497         labels:
498           alertgroup: "{{ $labels.instance }}"
499       - alert: systemd failed service
500         expr: node_systemd_unit_state{state="failed",name="chef-client.service"} == 1
501         for: 6h
502         labels:
503           alertgroup: "{{ $labels.instance }}"
504   - name: tile
505     rules:
506       - alert: renderd replication delay
507         expr: renderd_replication_delay > 120
508         for: 15m
509         labels:
510           alertgroup: tile
511         annotations:
512           delay: "{{ $value | humanizeDuration }}"
513       - alert: missed tile rate
514         expr: sum(rate(modtile_http_response_total{code="404"}[5m])) by (instance) / sum(rate(modtile_http_response_total[5m])) by (instance) > 0.05
515         for: 5m
516         labels:
517           alertgroup: tile
518         annotations:
519           miss_rate: "{{ $value | humanizePercentage }}"
520   - name: time
521     rules:
522       - alert: clock not synchronising
523         expr: min_over_time(node_timex_sync_status[1m]) == 0 and node_timex_maxerror_seconds >= 16
524         for: 5m
525         labels:
526           alertgroup: "{{ $labels.instance }}"
527       - alert: clock skew detected
528         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)
529         for: 5m
530         labels:
531           alertgroup: "{{ $labels.instance }}"
532         annotations:
533           skew: "{{ with printf \"node_timex_offset_seconds{instance='%s'}\" $labels.instance | query }} {{ . | humanizeDuration }}{{ end }}"
534   - name: web
535     rules:
536       - alert: web error rate
537         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
538         for: 5m
539         labels:
540           alertgroup: web
541         annotations:
542           error_rate: "{{ $value | humanizePercentage }}"
543       - alert: job processing rate
544         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
545         for: 15m
546         labels:
547           alertgroup: web
548         annotations:
549           job_processing_rate: "{{ $value | humanizePercentage }}"