Support Questions
Find answers, ask questions, and share your expertise

how to verify by API all services that are stop

Solved Go to solution
Highlighted

how to verify by API all services that are stop

we have Ambari cluster version 2.5

how to verify by API all services that are stop ( not started )

Michael-Bronson
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: how to verify by API all services that are stop

Super Mentor

@uri ben-ari

To list all the service status

#  curl -i --user admin:admin -i -H 'X-Requested-By: ambari' -X GET http://localhost:8080/api/v1/clusters/Sandbox/services?fields=ServiceInfo/state | grep -A 1 'service_name'

.

If you want to see only the services that are stopped (means in INSTALLED state) then you can try the following command:

# curl -i --user admin:admin -i -H 'X-Requested-By: ambari' -X GET http://localhost:8080/api/v1/clusters/Sandbox/services?fields=ServiceInfo/state | grep -B 1 'INSTALLED'

.

Example Output:

# curl -i --user admin:admin -i -H 'X-Requested-By: ambari' -X GET http://localhost:8080/api/v1/clusters/Sandbox/services?fields=ServiceInfo/state | grep -B 1 'INSTALLED'

        "service_name" : "AMBARI_INFRA",
        "state" : "INSTALLED"
--
        "service_name" : "AMBARI_METRICS",
        "state" : "INSTALLED"
--
        "service_name" : "ATLAS",
        "state" : "INSTALLED"
--
        "service_name" : "FALCON",
        "state" : "INSTALLED"
--
        "service_name" : "HBASE",
        "state" : "INSTALLED"
--
        "service_name" : "HDFS",
        "state" : "INSTALLED"
--
        "service_name" : "KAFKA",
        "state" : "INSTALLED"
--
        "service_name" : "KNOX",
        "state" : "INSTALLED"
--
        "service_name" : "LOGSEARCH",
        "state" : "INSTALLED"
--
        "service_name" : "PIG",
        "state" : "INSTALLED"
--
        "service_name" : "SLIDER",
        "state" : "INSTALLED"
--
        "service_name" : "SMARTSENSE",
        "state" : "INSTALLED"
--
        "service_name" : "SQOOP",
        "state" : "INSTALLED"
--
        "service_name" : "STORM",
        "state" : "INSTALLED"
--
        "service_name" : "TEZ",
        "state" : "INSTALLED"
--
        "service_name" : "ZOOKEEPER",
        "state" : "INSTALLED"

.

Here please replace the following:

1. "localhost" : with the Ambari FQDN

2. 8080 : with ambari port.

3. Sandbox : With cluster Name.

.

Reference: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=41812517

View solution in original post

3 REPLIES 3
Highlighted

Re: how to verify by API all services that are stop

Super Mentor

@uri ben-ari

To list all the service status

#  curl -i --user admin:admin -i -H 'X-Requested-By: ambari' -X GET http://localhost:8080/api/v1/clusters/Sandbox/services?fields=ServiceInfo/state | grep -A 1 'service_name'

.

If you want to see only the services that are stopped (means in INSTALLED state) then you can try the following command:

# curl -i --user admin:admin -i -H 'X-Requested-By: ambari' -X GET http://localhost:8080/api/v1/clusters/Sandbox/services?fields=ServiceInfo/state | grep -B 1 'INSTALLED'

.

Example Output:

# curl -i --user admin:admin -i -H 'X-Requested-By: ambari' -X GET http://localhost:8080/api/v1/clusters/Sandbox/services?fields=ServiceInfo/state | grep -B 1 'INSTALLED'

        "service_name" : "AMBARI_INFRA",
        "state" : "INSTALLED"
--
        "service_name" : "AMBARI_METRICS",
        "state" : "INSTALLED"
--
        "service_name" : "ATLAS",
        "state" : "INSTALLED"
--
        "service_name" : "FALCON",
        "state" : "INSTALLED"
--
        "service_name" : "HBASE",
        "state" : "INSTALLED"
--
        "service_name" : "HDFS",
        "state" : "INSTALLED"
--
        "service_name" : "KAFKA",
        "state" : "INSTALLED"
--
        "service_name" : "KNOX",
        "state" : "INSTALLED"
--
        "service_name" : "LOGSEARCH",
        "state" : "INSTALLED"
--
        "service_name" : "PIG",
        "state" : "INSTALLED"
--
        "service_name" : "SLIDER",
        "state" : "INSTALLED"
--
        "service_name" : "SMARTSENSE",
        "state" : "INSTALLED"
--
        "service_name" : "SQOOP",
        "state" : "INSTALLED"
--
        "service_name" : "STORM",
        "state" : "INSTALLED"
--
        "service_name" : "TEZ",
        "state" : "INSTALLED"
--
        "service_name" : "ZOOKEEPER",
        "state" : "INSTALLED"

.

Here please replace the following:

1. "localhost" : with the Ambari FQDN

2. 8080 : with ambari port.

3. Sandbox : With cluster Name.

.

Reference: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=41812517

View solution in original post

Re: how to verify by API all services that are stop

@Jay SenSharma did you saw my previos question ? (https://community.hortonworks.com/questions/127804/ambari-vlaue-from-ambari-gui-is-diff-from-the-conf.html)

Michael-Bronson
Highlighted

Re: how to verify by API all services that are stop

Super Mentor

@uri ben-ari Just updated the other thread.