gfraboni | be779fa | 2017-09-19 13:25:30 -0400 | [diff] [blame] | 1 | |
| 2 | # Query the Hbase service for the cluster status. |
Priyanka Jain | c07e1d1 | 2018-05-03 12:52:04 +0000 | [diff] [blame] | 3 | GET_CLUSTER_STATUS_RESPONSE=$(curl -si -X GET -H "Accept: text/xml" http://hbase:8080/status/cluster) |
gfraboni | be779fa | 2017-09-19 13:25:30 -0400 | [diff] [blame] | 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 |