0

How to verify service statuses via Ambari?

For example, I want to check in Ambari if the HDFS service is stopped or has been STARTED.

Until now I use the following syntax in order to check the service status:

ENDPOINT="http://${SERVER}:${PORT}/api/v1/clusters/${CLUSTERNAME}/services/${SERVICE}"
curl --silent -u admin:admin -X GET ${ENDPOINT}?fields=ServiceInfo | grep state

But I do not get the output about stopped/STARTED, as you can see from commands results. What we only get is INSTALLED:

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
 100  1207  100  1207    0     0  28158      0 --:--:-- --:--:-- --:--:-- 28738
 Checking HIVE
 {
    "href" : "http://master02.ipmassanalyt41.com:8080/api/v1/clusters/HDP26/services/HIVE?fields=ServiceInfo",
 "ServiceInfo" : {
   "cluster_name" : "HDP26",
    "credential_store_enabled" : "true",
   "credential_store_supported" : "true",
   "maintenance_state" : "OFF",
   "service_name" : "HIVE",
      "state" : "INSTALLED"
   }
0

The state INSTALLED indicates that the relevant service is installed but not started.

Quoting from the Ambari REST API Doc,

INSTALLED The service has been installed successfully but is not currently running.

You may need to start/restart the service.

If the service is running normally, the state will be STARTED.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.