Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

how to verify by API all services that are stop

avatar

we have Ambari cluster version 2.5

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

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Master 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

avatar
Master 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

avatar

@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

avatar
Master Mentor

@uri ben-ari Just updated the other thread.