]> git.openstreetmap.org Git - chef.git/blob - cookbooks/prometheus/templates/default/alert_rules.yml.erb
Merge branch 'patch-2' of https://github.com/Tigerfell/chef into pr257
[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: database
26     rules:
27       - alert: postgres replication delay
28         expr: pg_replication_lag_seconds > 5
29         for: 5m
30         labels:
31           alertgroup: database
32         annotations:
33           delay: "{{ $value | humanizeDuration }}"
34   - name: hwmon
35     rules:
36       - alert: hwmon fan alarm
37         expr: node_hwmon_fan_alarm == 1
38         for: 5m
39         labels:
40           alertgroup: "{{ $labels.instance }}"
41         annotations:
42           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}}"
43           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}}"
44       - alert: hwmon temperature alarm
45         expr: node_hwmon_temp_alarm == 1
46         for: 5m
47         labels:
48           alertgroup: "{{ $labels.instance }}"
49         annotations:
50           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}}"
51           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}}"
52           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}}"
53       - alert: hwmon voltage alarm
54         expr: node_hwmon_in_alarm == 1
55         for: 5m
56         labels:
57           alertgroup: "{{ $labels.instance }}"
58         annotations:
59           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}}"
60           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}}"
61           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}}"
62   - name: ipmi
63     rules:
64       - alert: ipmi fan alarm
65         expr: ipmi_fan_speed_state > 0
66         for: 5m
67         labels:
68           alertgroup: "{{ $labels.instance }}"
69         annotations:
70           fan_speed_rpm: "{{ with printf \"ipmi_fan_speed_rpm{instance='%s',id='%s'}\" $labels.instance $labels.id | query }}{{ . | first | value | humanize }}rpm{{end}}"
71       - alert: ipmi temperature alarm
72         expr: ipmi_temperature_state > 0
73         for: 5m
74         labels:
75           alertgroup: "{{ $labels.instance }}"
76         annotations:
77           temperature_celsius: "{{ with printf \"ipmi_temperature_celsius{instance='%s',id='%s'}\" $labels.instance $labels.id | query }}{{ . | first | value | humanize }}C{{end}}"
78       - alert: ipmi voltage alarm
79         expr: ipmi_voltage_state > 0
80         for: 5m
81         labels:
82           alertgroup: "{{ $labels.instance }}"
83         annotations:
84           voltage_volts: "{{ with printf \"ipmi_voltage_volts{instance='%s',id='%s'}\" $labels.instance $labels.id | query }}{{ . | first | value | humanize }}V{{end}}"
85       - alert: ipmi power alarm
86         expr: ipmi_power_state > 0 or ipmi_sensor_state{type=~"Power .*"} > 0
87         for: 5m
88         labels:
89           alertgroup: "{{ $labels.instance }}"
90   - name: mdadm
91     rules:
92       - alert: mdadm array inactive
93         expr: node_md_state{state="inactive"} > 0
94         for: 0m
95         labels:
96           alertgroup: "{{ $labels.instance }}"
97         annotations:
98           required: "{{ with printf \"node_md_disks_required{instance='%s',device='%s'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
99           active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
100           failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
101           spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
102       - alert: mdadm disk failed
103         expr: node_md_disks{state="failed"} > 0
104         for: 0m
105         labels:
106           alertgroup: "{{ $labels.instance }}"
107         annotations:
108           required: "{{ with printf \"node_md_disks_required{instance='%s',device='%s'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
109           active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
110           failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
111           spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
112   - name: memory
113     rules:
114       - alert: low memory
115         expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes < 0.1
116         for: 5m
117         labels:
118           alertgroup: "{{ $labels.instance }}"
119         annotations:
120           memory_free: "{{ $value | humanizePercentage }}"
121       - alert: memory pressure
122         expr: rate(node_vmstat_pgmajfault[1m]) > 1000
123         for: 5m
124         labels:
125           alertgroup: "{{ $labels.instance }}"
126         annotations:
127           major_page_faults: "{{ $value }} faults/s"
128       - alert: oom kill detected
129         expr: increase(node_vmstat_oom_kill[1m]) > 0
130         for: 0m
131         labels:
132           alertgroup: "{{ $labels.instance }}"
133         annotations:
134           new_oom_kills: "{{ $value }}"
135   - name: network
136     rules:
137       - alert: interface transmit rate
138         expr: rate(node_network_transmit_bytes_total[1m]) / node_network_speed_bytes > 0.98
139         for: 5m
140         labels:
141           alertgroup: "{{ $labels.instance }}"
142         annotations:
143           bandwidth_used: "{{ $value | humanizePercentage }}"
144       - alert: interface receive rate
145         expr: rate(node_network_receive_bytes_total[1m]) / node_network_speed_bytes > 0.98
146         for: 5m
147         labels:
148           alertgroup: "{{ $labels.instance }}"
149         annotations:
150           bandwidth_used: "{{ $value | humanizePercentage }}"
151       - alert: interface transmit errors
152         expr: rate(node_network_transmit_errs_total[1m]) / rate(node_network_transmit_packets_total[1m]) > 0.01
153         for: 5m
154         labels:
155           alertgroup: "{{ $labels.instance }}"
156         annotations:
157           error_rate: "{{ $value | humanizePercentage }}"
158       - alert: interface receive errors
159         expr: rate(node_network_receive_errs_total[1m]) / rate(node_network_receive_packets_total[1m]) > 0.01
160         for: 5m
161         labels:
162           alertgroup: "{{ $labels.instance }}"
163         annotations:
164           error_rate: "{{ $value | humanizePercentage }}"
165       - alert: conntrack entries
166         expr: node_nf_conntrack_entries / node_nf_conntrack_entries_limit > 0.8
167         for: 5m
168         labels:
169           alertgroup: "{{ $labels.instance }}"
170         annotations:
171           entries_used: "{{ $value | humanizePercentage }}"
172   - name: postgresql
173     rules:
174       - alert: postgresql down
175         expr: pg_up == 0
176         for: 1m
177         labels:
178           alertgroup: "{{ $labels.instance }}"
179       - alert: postgresql replication delay
180         expr: pg_replication_lag_seconds > 5
181         for: 1m
182         labels:
183           alertgroup: "{{ $labels.instance }}"
184         annotations:
185           delay: "{{ $value | humanizeDuration }}"
186       - alert: postgresql connection limit
187         expr: sum (pg_stat_activity_count) by (instance, server) / sum (pg_settings_max_connections) by (instance, server) > 0.8
188         for: 1m
189         labels:
190           alertgroup: "{{ $labels.instance }}"
191         annotations:
192           connections_used: "{{ $value | humanizePercentage }}"
193       - alert: postgresql deadlocks
194         expr: increase(pg_stat_database_deadlocks[1m]) > 5
195         for: 0m
196         labels:
197           alertgroup: "{{ $labels.instance }}"
198         annotations:
199           new_deadlocks: "{{ $value }}"
200       - alert: postgresql slow queries
201         expr: pg_slow_queries > 0
202         for: 5m
203         labels:
204           alertgroup: "{{ $labels.instance }}"
205         annotations:
206           queries: "{{ $value }}"
207   - name: ssl
208     rules:
209       - alert: ssl certificate probe failed
210         expr: ssl_probe_success == 0
211         for: 60m
212         labels:
213           alertgroup: ssl
214       - alert: ssl certificate expiry
215         expr: ssl_verified_cert_not_after{chain_no="0"} - time() < 86400 * 14
216         for: 0m
217         labels:
218           alertgroup: ssl
219         annotations:
220           expires_in: "{{ $value | humanizeDuration }}"
221       - alert: ssl certificate revoked
222         expr: ssl_ocsp_response_status == 1
223         for: 0m
224         labels:
225           alertgroup: ssl
226       - alert: ocsp status unknown
227         expr: ssl_ocsp_response_status == 1
228         for: 0m
229         labels:
230           alertgroup: ssl
231   - name: tile
232     rules:
233       - alert: renderd replication delay
234         expr: renderd_replication_delay > 120
235         for: 5m
236         labels:
237           alertgroup: tile
238         annotations:
239           delay: "{{ $value | humanizeDuration }}"
240       - alert: missed tile rate
241         expr: sum(rate(modtile_http_response_total{code="404"}[5m])) by (instance) / sum(rate(modtile_http_response_total[5m])) by (instance) > 0.05
242         for: 5m
243         labels:
244           alertgroup: tile
245         annotations:
246           miss_rate: "{{ $value | humanizePercentage }}"
247   - name: time
248     rules:
249       - alert: clock not synchronising
250         expr: min_over_time(node_timex_sync_status[1m]) == 0 and node_timex_maxerror_seconds >= 16
251         for: 5m
252         labels:
253           alertgroup: "{{ $labels.instance }}"
254       - alert: clock skew detected
255         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)
256         for: 5m
257         labels:
258           alertgroup: "{{ $labels.instance }}"
259         annotations:
260           skew: "{{ with printf \"node_timex_offset_seconds{instance='%s'}\" $labels.instance | query }} {{ . | humanizeDuration }}{{ end }}"