-
Notifications
You must be signed in to change notification settings - Fork 0
/
healthcheck.sh
executable file
·46 lines (42 loc) · 1.51 KB
/
healthcheck.sh
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
#!/bin/bash
if [[ "$HADOOP_SERVICES" == *"namenode"* ]]; then
if [[ -z $HEALTHCHECK_URL_NAMENODE ]]; then
export HEALTHCHECK_URL_NAMENODE="localhost:9870"
fi
if [[ $(curl -LI "$HEALTHCHECK_URL_NAMENODE/jmx" -s -o /dev/null -w "%{http_code}") -ne 200 ]]; then
exit 1
fi
fi
if [[ "$HADOOP_SERVICES" == *"resourcemanager"* ]]; then
if [[ -z $HEALTHCHECK_URL_RESOURCEMANAGER ]]; then
export HEALTHCHECK_URL_RESOURCEMANAGER="localhost:8088"
fi
if [[ $(curl -LI "$HEALTHCHECK_URL_RESOURCEMANAGER/jmx" -s -o /dev/null -w "%{http_code}") -ne 200 ]]; then
exit 1
fi
fi
if [[ "$HADOOP_SERVICES" == *"historyserver"* ]]; then
if [[ -z $HEALTHCHECK_URL_HISTORYSERVER ]]; then
export HEALTHCHECK_URL_HISTORYSERVER="localhost:19888"
fi
if [[ $(curl -LI "$HEALTHCHECK_URL_HISTORYSERVER/jmx" -s -o /dev/null -w "%{http_code}") -ne 200 ]]; then
exit 1
fi
fi
if [[ "$HADOOP_SERVICES" == *"nodemanager"* ]]; then
if [[ -z $HEALTHCHECK_URL_NODEMANAGER ]]; then
export HEALTHCHECK_URL_NODEMANAGER="localhost:8042"
fi
if [[ $(curl -LI "$HEALTHCHECK_URL_NODEMANAGER/jmx" -s -o /dev/null -w "%{http_code}") -ne 200 ]]; then
exit 1
fi
fi
if [[ "$HADOOP_SERVICES" == *"datanode"* ]]; then
if [[ -z $HEALTHCHECK_URL_DATANODE ]]; then
export HEALTHCHECK_URL_DATANODE="localhost:9864"
fi
if [[ $(curl -LI "$HEALTHCHECK_URL_DATANODE/jmx" -s -o /dev/null -w "%{http_code}") -ne 200 ]]; then
exit 1
fi
fi
exit 0