-
Notifications
You must be signed in to change notification settings - Fork 542
Expand file tree
/
Copy pathprometheus-alert-rules-zookeeper.yaml
More file actions
373 lines (337 loc) · 26.2 KB
/
prometheus-alert-rules-zookeeper.yaml
File metadata and controls
373 lines (337 loc) · 26.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
prometheus: prometheus
role: alert-rules
name: prometheus-zookeeper-rules
spec:
groups:
# based on https://blog.serverdensity.com/how-to-monitor-zookeeper/
# and https://github.com/apache/zookeeper/blob/master/zookeeper-contrib/zookeeper-contrib-monitoring/nagios/services.cfg
- name: ZookeeperRules
rules:
- alert: ZookeeperDown
expr: up{app=~'zookeeper.*'} == 0
labels:
severity: critical
annotations:
identifier: "{{ $labels.pod_name }}"
summary: "zookeeper possible down"
description: |-
`zookeeper` can't be scraped via prometheus.
Please check instance status
```kubectl logs -n {{ $labels.namespace }} {{ $labels.pod_name }} -f```
- alert: ZookeeperRestartRecently
expr: uptime{app=~'zookeeper.*'} > 1 < 180000
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Amount of time since the server was started."
description: |-
`uptime{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "uptime{pod_name='%s',namespace='%s'} / 1000" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | humanizeDuration }}{{ end }}
Look to previous Zookeeper pod log to investigate restart reason
```
kubectl logs -n {{ $labels.namespace }} pod/{{ $labels.pod_name }} --previous
```
- alert: ZookeeperHighLatency
expr: avg_latency{app=~'zookeeper.*'} > 500
for: 15m
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Average amount of time it takes for the server to respond to each client request (since the server was started)."
description: |-
`avg_latency{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "avg_latency{pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} ticks{{ end }}
reset server statistics
```
kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- bash -xc "echo stats_reset | nc localhost 2181"
```
Look to CPU/Memory node/pod utilization
```
kubectl top -n {{ $labels.namespace }} pod {{ $labels.pod_name }}
kubectl top node {{ $labels.node }}
```
Look to Zookeeper Disk free space
```
kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- df -h
```
Look to zookeeper read\write
```
readBegin=$(kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- cat /proc/1/io | grep -E "^rchar" | cut -d " " -f 2)
writeBegin=$(kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- cat /proc/1/io | grep -E "^wchar" | cut -d " " -f 2)
sleep 5
readEnd=$(kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- cat /proc/1/io | grep -E "^rchar" | cut -d " " -f 2)
writeEnd=$(kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- cat /proc/1/io | grep -E "^wchar" | cut -d " " -f 2)
echo "Zookeeper Read $((($readEnd - $readBegin) / 5)) b/s"
echo "Zookeeper Write $((($writeEnd - $writeBegin) / 5)) b/s"
```
- alert: ZookeeperOutstandingRequests
expr: outstanding_requests{app=~'zookeeper.*'} > 10
for: 10m
labels:
severity: high
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper receives more requests than it can process."
description: |-
`outstanding_requests{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "outstanding_requests{pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }}{{ end }}
Look to CPU/Memory node/pod utilization
```
kubectl top -n {{ $labels.namespace }} pod {{ $labels.pod_name }}
kubectl top node {{ $labels.node }}
```
Look to Zookeeper Disk free space
```
kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- df -h
```
Look to zookeeper read\write
```
readBegin=$(kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- cat /proc/1/io | grep -E "^rchar" | cut -d " " -f 2)
writeBegin=$(kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- cat /proc/1/io | grep -E "^wchar" | cut -d " " -f 2)
sleep 5
readEnd=$(kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- cat /proc/1/io | grep -E "^rchar" | cut -d " " -f 2)
writeEnd=$(kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- cat /proc/1/io | grep -E "^wchar" | cut -d " " -f 2)
echo "Zookeeper Read $((($readEnd - $readBegin) / 5)) b/s"
echo "Zookeeper Write $((($writeEnd - $writeBegin) / 5)) b/s"
```
- alert: ZookeeperHighFileDescriptors
expr: (open_file_descriptor_count{app=~'zookeeper.*'} / max_file_descriptor_count{app=~'zookeeper.*'}) > 0.7
for: 10m
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Number of file descriptors used over the limit."
description: |-
`open_file_descriptor_count{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "open_file_descriptor_count{pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} descriptors{{ end }}
`process_open_fds{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "process_open_fds{pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} descriptors{{ end }}
- alert: ZookeeperPendingSyncs
expr: pending_syncs{app=~'zookeeper.*'} > 10
for: 5m
labels:
severity: high
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Possible Zookeeper master pending syncs with followers."
description: |-
`pending_session_queue_size{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "pending_session_queue_size{pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} sessions{{ end }}
- alert: ZookeeperPendingSessions
expr: pending_session_queue_size{app=~'zookeeper.*'} > 10
for: 10m
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Possible Zookeeper pending sessions."
description: |-
`pending_session_queue_size{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "pending_session_queue_size{pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} sessions{{ end }}
- alert: ZookeeperThrottleRequests
expr: increase(request_throttle_wait_count{app=~'zookeeper.*'}[1m]) > 0
for: 10m
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper throttle requests"
description: |-
`increase(request_throttle_wait_count{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(request_throttle_wait_count{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} requests{{ end }}
Look `requestThrottleLimit`, `requestThrottleStallTime` in documentation:
https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_advancedConfiguration
- alert: ZookeeperOutstandingTLSHandshakes
expr: outstanding_tls_handshake{app=~'zookeeper.*'} > 0
for: 10m
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper receives more TLS handshake than it can process."
description: |-
`outstanding_tls_handshake{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "outstanding_tls_handshake{pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} requests{{ end }}
- alert: ZookeeperConnectionRejected
expr: increase(connection_rejected{app=~'zookeeper.*'}[1m]) > 0
for: 10m
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper reject connection."
description: |-
`increase(connection_rejected{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(connection_rejected{pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} requests{{ end }}
Check connections count on Zookeeper
```
kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- cat /proc/net/sockstat
kubectl exec -n {{ $labels.namespace }} {{ $labels.pod_name }} -- cat /proc/net/sockstat6
```
- alert: ZookeeperHighEphemeralNodes
expr: ephemerals_count{app=~'zookeeper.*'} > 100
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper have too high ephemeral znodes count."
description: |-
`ephemerals_count{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "ephemerals_count{pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} nodes{{ end }}
Look to documentation:
https://zookeeper.apache.org/doc/current/zookeeperOver.html#Nodes+and+ephemeral+nodes
- alert: ZookeeperUnrecoverableErrors
expr: increase(unrecoverable_error_count{app=~'zookeeper.*'}[1m]) > 0
labels:
severity: high
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper have unhandled Exception"
description: |-
`increase(unrecoverable_error_count{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "rate(unrecoverable_error_count{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} exceptions{{ end }}
It mean Zookeeper catch some unknown Exception and will close listen socket
Look to current and previous Zookeeper pod log to investigate restart reason
```
kubectl logs -n {{ $labels.namespace }} pod/{{ $labels.pod_name }}
kubectl logs -n {{ $labels.namespace }} pod/{{ $labels.pod_name }} --previous
```
- alert: ZookeeperLowGetDataCacheHitRate
expr: increase(response_packet_cache_hits{app=~'zookeeper.*'}[1m]) / (increase(response_packet_cache_misses{app=~'zookeeper.*'}[1m]) + increase(response_packet_cache_hits{app=~'zookeeper.*'}[1m]) ) < 0.3
for: 10m
labels:
severity: info
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper have inefficient get data znodes response cache."
description: |-
`increase(response_packet_cache_hits{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(response_packet_cache_hits{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} hits{{ end }}
`increase(response_packet_cache_misses{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(response_packet_cache_misses{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} misses{{ end }}
`Get Data Cache Hit Rate` = {{ with printf "increase(response_packet_cache_hits{pod_name='%s',namespace='%s'}[1m]) / (increase(response_packet_cache_misses{pod_name='%s',namespace='%s'}[1m]) + increase(response_packet_cache_hits{pod_name='%s',namespace='%s'}[1m]))" .Labels.pod_name .Labels.namespace .Labels.pod_name .Labels.namespace .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }}{{ end }}
For heavy read workloads Zookeeper try to cache response for `get data` API method for save the serialization cost on popular znodes.
Try to tune `maxResponseCacheSize`
Look to documentation:
https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_advancedConfiguration
- alert: ZookeeperLowGetChildrenCacheHitRate
expr: increase(response_packet_get_children_cache_hits{app=~'zookeeper.*'}[1m]) / (increase(response_packet_get_children_cache_misses{app=~'zookeeper.*'}[1m]) + increase(response_packet_get_children_cache_hits{app=~'zookeeper.*'}[1m]) ) < 0.3
for: 10m
labels:
severity: info
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper have inefficient get data znodes response cache."
description: |-
`increase(response_packet_get_children_cache_hits{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(response_packet_get_children_cache_hits{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} hits{{ end }}
`increase(response_packet_get_children_cache_misses{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(response_packet_get_children_cache_misses{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} misses{{ end }}
`Get Children Cache Hit Rate` = {{ with printf "increase(response_packet_get_children_cache_hits{pod_name='%s',namespace='%s'}[1m]) / (increase(response_packet_get_children_cache_misses{pod_name='%s',namespace='%s'}[1m]) + increase(response_packet_get_children_cache_hits{pod_name='%s',namespace='%s'}[1m]))" .Labels.pod_name .Labels.namespace .Labels.pod_name .Labels.namespace .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }}{{ end }}
For heavy read workloads Zookeeper try to cache response for `get children` API method for save the serialization cost on popular znodes.
Try to tune `maxGetChildrenResponseCacheSize`
Look to documentation:
https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_advancedConfiguration
- alert: ZookeeperEnsembleAuthFailures
expr: increase(ensemble_auth_fail{app=~'zookeeper.*'}[1m]) > 0
for: 10m
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper authentication failures with `ensemble` scheme."
description: |-
`increase(ensemble_auth_fail{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(response_packet_get_children_cache_hits{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} failures{{ end }}
Look to `ensembleAuthName` in documentation:
https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_authOptions
- alert: ZookeeperHighFsyncTime
expr: fsynctime{quantile="0.5", app=~'zookeeper.*'} > 10
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper have slow fsync to disk."
description: |-
`increase(fsynctime_sum{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(fsynctime_sum{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} ms{{ end }}
`increase(fsynctime_count{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(fsynctime_count{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} count{{ end }}
`fsynctime{quantile="0.5",pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "fsynctime{quantile='0.5',pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} ms{{ end }}
It mean writes to Transactional Log (WAL) takes more time than expected. If a Zookkeper crashes it can replay the WAL to recover its previous state after restart.
- alert: ZookeeperLargeRequestsRejected
expr: increase(large_requests_rejected{app=~'zookeeper.*'}[1m]) > 0
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper reject some large requests."
description: |-
`increase(large_requests_rejected{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(large_requests_rejected{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} requests{{ end }}
It mean Zookeeper avoid JVM allocate too much memory and runs out of usable heap and ultimately crashes.
Look to `largeRequestMaxBytes` and `largeRequestThreshold` options in documentation:
https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_advancedConfiguration
- alert: ZookeeperStaleRequestsDropped
expr: increase(stale_requests_dropped{app=~'zookeeper.*'}[1m]) > 0
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper dropped stale requests."
description: |-
`increase(stale_requests_dropped{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(stale_requests_dropped{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} requests{{ end }}
`Stale request` is a request sent by a connection that is now closed, and/or a request that will have a request latency higher than the `sessionTimeout`.
Look to `requestThrottleDropStale`, `requestStaleLatencyCheck`, `requestStaleConnectionCheck` options in documentation:
https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_advancedConfiguration
- alert: ZookeeperDigestMismatch
expr: increase(digest_mismatches_count{app=~'zookeeper.*'}[1m]) > 0
labels:
severity: critical
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper have inconsistent data in memory."
description: |-
`increase(digest_mismatches_count{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(digest_mismatches_count{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} mismatches{{ end }}
The digest feature is added to detect the data inconsistency inside ZooKeeper when loading database from disk, catching up and following leader, its doing incrementally hash check for the DataTree based on the adHash.
Look to `digest.enabled` options in documentation:
https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_advancedConfiguration
- alert: ZookeeperSessionlessConnectionExpires
expr: increase(sessionless_connections_expired[1m]) > 0
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper close connection without session."
description: |-
`increase(sessionless_connections_expired{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}[1m])` = {{ with printf "increase(sessionless_connections_expired{pod_name='%s',namespace='%s'}[1m])" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.2f" }} sessionless connections{{ end }}
Look to `minSessionTimeout`,`maxSessionTimeout` options in documentation:
https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_advancedConfiguration
- alert: ZookeeperThreadsDeadlocked
expr: jvm_threads_deadlocked{app=~'zookeeper.*'} > 0
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper JVM threads Deadlock occurred."
description: |-
JVM Thread Deadlock means a situation where two or more JVM threads are blocked forever, waiting for each other.
Deadlock occurs when multiple threads need the same locks but obtain them in different order.
As a quick workaround - pod restart
```
kubectl exec -n {{ $labels.namespace }} pod/{{ $labels.pod_name }} -- kill 1
```
Look to current Zookeeper pod log to investigate Deadlock reason
```
kubectl logs -n {{ $labels.namespace }} pod/{{ $labels.pod_name }} -f | grep -i -E "deadlock|exception"
```
Also look to JVM documentation about threads state:
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.State.html
`jvm_threads_deadlocked{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "jvm_threads_deadlocked{pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.0f" }}{{ end }}
`jvm_threads_current{pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "jvm_threads_current{pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.0f" }}{{ end }}
`jvm_threads_state{state="NEW",pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "jvm_threads_state{state='NEW',pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.0f" }}{{ end }}
`jvm_threads_state{state="RUNNABLE",pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "jvm_threads_state{state='RUNNABLE',pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.0f" }}{{ end }}
`jvm_threads_state{state="BLOCKED",pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "jvm_threads_state{state='BLOCKED',pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.0f" }}{{ end }}
`jvm_threads_state{state="WAITING",pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "jvm_threads_state{state='WAITING',pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.0f" }}{{ end }}
`jvm_threads_state{state="TIMED_WAITING",pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "jvm_threads_state{state='TIMED_WAITING',pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.0f" }}{{ end }}
`jvm_threads_state{state="TERMINATED",pod_name="{{ $labels.pod_name }}",namespace="{{ $labels.namespace }}"}` = {{ with printf "jvm_threads_state{state='TERMINATED',pod_name='%s',namespace='%s'}" .Labels.pod_name .Labels.namespace | query }}{{ . | first | value | printf "%.0f" }}{{ end }}
- alert: ZookeeperUnsuccessfulSSLHandshakes
expr: increase(unsuccessful_handshake{app=~'zookeeper.*'}[1m]) > 0
labels:
severity: warning
annotations:
identifier: "{{ $labels.pod_name }}.{{ $labels.namespace }}"
summary: "Zookeeper Unsuccessful Handshakes occurred."
description: |-
Look to `ssl.*` options in documentation:
https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_authOptions
Look to current Zookeeper pod log to investigate unsucessfull handshake reason
```
kubectl logs -n {{ $labels.namespace }} pod/{{ $labels.pod_name }} -f | grep -i -E "tls|ssl|auth|cert|handshake"
```