-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathhealthcheck.sh
More file actions
executable file
·37 lines (27 loc) · 881 Bytes
/
healthcheck.sh
File metadata and controls
executable file
·37 lines (27 loc) · 881 Bytes
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
#!/usr/bin/env bash
#
# Simple script that pings the Metamapper healthcheck endpoint and confirms all
# services are available and healthy.
set -e
sleep 60
HEALTHCHECK_URL="localhost:5050/health"
EXPECTED_STATUS="healthy"
function healthcheck() {
curl -s $HEALTHCHECK_URL | jq --raw-output "$1"
}
METASTORE_STATUS=$(healthcheck '.metastore.status')
if [[ "$METASTORE_STATUS" != "$EXPECTED_STATUS" ]]; then
echo "Metastore health check failed: $METASTORE_STATUS"
exit 1
fi
WORKER_STATUS=$(healthcheck '.worker.status')
if [[ "$WORKER_STATUS" != "$EXPECTED_STATUS" ]]; then
echo "Worker health check failed: $WORKER_STATUS"
exit 1
fi
SCHEDULER_STATUS=$(healthcheck '.scheduler.status')
if [[ "$SCHEDULER_STATUS" != "$EXPECTED_STATUS" ]]; then
echo "Scheduler health check failed: $SCHEDULER_STATUS"
exit 1
fi
echo "Healthchecks have all passed."