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.

REST API + how to verify that all components are stop

avatar

hi all

we have 3 masters machines ( master01 master02 master03 ) and on each master machine we have the relevant component

how to verify by API that all component on the specific master machine are stop?

for example we want to verify that all component on master01 are stoped

the API will return info (stop/start) about all componets that are run on master01

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Super Guru

@Michael Bronson,

You can use the below curl call to get the info

curl -u {ambari-username}:{ambari-password} -H "X-Requested-By: ambari" -X GET http://{ambari-host}:{ambari-port}/api/v1/clusters/{clustername}/hosts/{host-name}/host_components?f...


Sample response:

{
  "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03/host_components?fields=HostRoles/state",
  "items": [
    {
      "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03/host_components/ACCUMULO_CLIENT",
      "HostRoles": {
        "cluster_name": "cl1",
        "component_name": "ACCUMULO_CLIENT",
        "host_name": "master03",
        "state": "INSTALLED"
      },
      "host": {
        "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03"
      }
    },
    {
      "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03/host_components/APP_TIMELINE_SERVER",
      "HostRoles": {
        "cluster_name": "cl1",
        "component_name": "APP_TIMELINE_SERVER",
        "host_name": "master03",
        "state": "STARTED"
      },
      "host": {
        "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03"
      }
    }
  ]
}

Thanks,

Aditya

View solution in original post

1 REPLY 1

avatar
Super Guru

@Michael Bronson,

You can use the below curl call to get the info

curl -u {ambari-username}:{ambari-password} -H "X-Requested-By: ambari" -X GET http://{ambari-host}:{ambari-port}/api/v1/clusters/{clustername}/hosts/{host-name}/host_components?f...


Sample response:

{
  "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03/host_components?fields=HostRoles/state",
  "items": [
    {
      "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03/host_components/ACCUMULO_CLIENT",
      "HostRoles": {
        "cluster_name": "cl1",
        "component_name": "ACCUMULO_CLIENT",
        "host_name": "master03",
        "state": "INSTALLED"
      },
      "host": {
        "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03"
      }
    },
    {
      "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03/host_components/APP_TIMELINE_SERVER",
      "HostRoles": {
        "cluster_name": "cl1",
        "component_name": "APP_TIMELINE_SERVER",
        "host_name": "master03",
        "state": "STARTED"
      },
      "host": {
        "href": "http://10.10.1.1:8080/api/v1/clusters/cl1/hosts/master03"
      }
    }
  ]
}

Thanks,

Aditya