- Determine the version of API you are using:
curl -u username:password http://
in CDH5.7.x, it should return “v12”.:7180/api/version - get the cluster name from the output of:
curl -u username:password http://
sample output::7180/api/v12/clusters { "items" : [ { "name" : "cluster", "displayName" : "Cluster 1", "version" : "CDH5", "fullVersion" : "5.7.0", "maintenanceMode" : false, "maintenanceOwners" : [ ], "clusterUrl" : "http://
take note of the value for “name” attribute, in my case it is “cluster”.:7180/cmf/clusterRedirect/cluster", "hostsUrl" : "http:// :7180/cmf/clusterRedirect/cluster/hosts", "entityStatus" : "GOOD_HEALTH" } ] } - get the services in the cluster:
curl -u username:password http://
substitute with our cluster’s name::7180/api/v12/clusters/ /services curl -u username:password http://
please locate the impala service and get its “name”, in my case it is “impala”::7180/api/v12/clusters/cluster/services { "name" : "impala", "type" : "IMPALA", "clusterRef" : { "clusterName" : "cluster" }, .... }
- get the all the roles under impala service:
curl -u username:password http://
in my case should be::7180/api/v12/clusters/ /services/ /roles/ curl -u username:password http://
locate the role that you want to monitor, I picked Statestore::7180/api/v12/clusters/cluster/services/impala/roles { "name" : "impala-STATESTORE-52cc0fbf54f5cc038b2b0a67634034fe", "type" : "STATESTORE", "serviceRef" : { "clusterName" : "cluster", "serviceName" : "impala" }, .... }
in my case it is “impala-STATESTORE-52cc0fbf54f5cc038b2b0a67634034fe” -
get the status for the role you want to monitor:
curl -u username:password http://
after substitution, it should be::7180/api/v12/clusters/ /services/ /roles/ curl -u username:password http://
this will give you full status output for this particular role::7180/api/v12/clusters/cluster/services/impala/roles/impala-STATESTORE-52cc0fbf54f5cc038b2b0a67634034fe { "name" : "impala-STATESTORE-52cc0fbf54f5cc038b2b0a67634034fe", "type" : "STATESTORE", "serviceRef" : { "clusterName" : "cluster", "serviceName" : "impala" }, "hostRef" : { "hostId" : "eff96b49-739e-48d4-a19b-e5865a83b164" }, ..... "configStalenessStatus" : "FRESH", "maintenanceMode" : false, "maintenanceOwners" : [ ], "commissionState" : "COMMISSIONED", "roleConfigGroupRef" : { "roleConfigGroupName" : "impala-STATESTORE-BASE" }, "entityStatus" : "GOOD_HEALTH" }
look for the last attribute called “entityStatus”, it has the following possible values:UNKNOWN NONE STOPPED DOWN UNKNOWN_HEALTH DISABLED_HEALTH CONCERNING_HEALTH BAD_HEALTH GOOD_HEALTH STARTING STOPPING HISTORY_NOT_AVAILABLE
in the case that it is exited unexpectedly, the value would be “DOWN”, so that we can programmatically decide whether we can just restart it or not.