Run all components in one namespace
[oom.git] / kubernetes / config / docker / init / src / config / consul / consul-agent-config / scripts / tabular-db-availability.sh
1
2 # Query the Hbase service for the cluster status.
3 GET_CLUSTER_STATUS_RESPONSE=$(curl -si -X GET -H "Accept: text/xml" http://hbase.namespace-placeholder:8080/status/cluster)
4
5 if [ -z "$GET_CLUSTER_STATUS_RESPONSE" ]; then
6   echo "Tabular store is unreachable."
7   return 2 
8 fi
9
10 # Check the resulting status JSON to see if there is a 'DeadNodes' stanza with 
11 # entries.
12 DEAD_NODES=$(echo $GET_CLUSTER_STATUS_RESPONSE | grep "<DeadNodes/>")
13
14 if [ -n "$DEAD_NODES" ]; then
15   echo "Tabular store is up and accessible."
16   return 0
17 else
18   echo "Tabular store is up but is reporting dead nodes - cluster may be in degraded state."
19   return 1
20 fi