Skip to content

Commit fd9a43a

Browse files
committed
add healthcheck for disk usage with configurable thresholds
1 parent 7a9bc0f commit fd9a43a

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

message-bus-kafka/docker-compose.cluster.kafka.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ services:
88
placement:
99
constraints:
1010
- "node.labels.name==${KAFKA_01_PLACEMENT}"
11+
healthcheck:
12+
test: ["CMD-SHELL", "df bitnami/kafka -h | tail -n 1 | awk '{print $$5}' | cut -d'%' -f1 | awk '{exit ($$1 > ${KAFKA_01_DISK_USAGE_THRESHOLD})}'"]
13+
interval: 10s
14+
timeout: 5s
15+
retries: 5
16+
start_period: 10s
1117

1218
kafka-02:
1319
image: ${KAFKA_IMAGE}
@@ -40,6 +46,12 @@ services:
4046
memory: ${KAFKA_MEMORY_RESERVE}
4147
restart_policy:
4248
condition: on-failure
49+
healthcheck:
50+
test: ["CMD-SHELL", "df bitnami/kafka -h | tail -n 1 | awk '{print $$5}' | cut -d'%' -f1 | awk '{exit ($$1 > ${KAFKA_02_DISK_USAGE_THRESHOLD})}'"]
51+
interval: 30s
52+
timeout: 10s
53+
retries: 3
54+
start_period: 30s
4355
networks:
4456
public:
4557
default:
@@ -75,6 +87,12 @@ services:
7587
memory: ${KAFKA_MEMORY_RESERVE}
7688
restart_policy:
7789
condition: on-failure
90+
healthcheck:
91+
test: ["CMD-SHELL", "df bitnami/kafka -h | tail -n 1 | awk '{print $$5}' | cut -d'%' -f1 | awk '{exit ($$1 > ${KAFKA_03_DISK_USAGE_THRESHOLD})}'"]
92+
interval: 30s
93+
timeout: 10s
94+
retries: 3
95+
start_period: 30s
7896
networks:
7997
public:
8098
default:

message-bus-kafka/package-metadata.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
"KMINION_CPU_LIMIT": "0",
2929
"KMINION_MEMORY_LIMIT": "3G",
3030
"KMINION_CPU_RESERVE": "0.05",
31-
"KMINION_MEMORY_RESERVE": "500M"
31+
"KMINION_MEMORY_RESERVE": "500M",
32+
"KAFKA_01_DISK_USAGE_THRESHOLD": "90",
33+
"KAFKA_02_DISK_USAGE_THRESHOLD": "90",
34+
"KAFKA_03_DISK_USAGE_THRESHOLD": "90"
3235
}
3336
}

0 commit comments

Comments
 (0)