gfraboni | be779fa | 2017-09-19 13:25:30 -0400 | [diff] [blame] | 1 | |
| 2 | # Query the Hbase service for the cluster status. |
Priyanka Jain | 1fda968 | 2018-05-09 08:42:50 +0000 | [diff] [blame] | 3 | GET_CLUSTER_STATUS_RESPONSE=$(curl -si -X GET -H "Accept: text/xml" http://aai-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." |
Priyanka Jain | 1fda968 | 2018-05-09 08:42:50 +0000 | [diff] [blame] | 7 | return 2 |
gfraboni | be779fa | 2017-09-19 13:25:30 -0400 | [diff] [blame] | 8 | fi |
| 9 | |
Priyanka Jain | 1fda968 | 2018-05-09 08:42:50 +0000 | [diff] [blame] | 10 | # Check the resulting status JSON to see if there is a 'DeadNodes' stanza with |
gfraboni | be779fa | 2017-09-19 13:25:30 -0400 | [diff] [blame] | 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 |