Support Questions

Find answers, ask questions, and share your expertise

Run service checks on each of ambari services

avatar

need advice about the following:

as all know we can do service check on each of the services in ambari cluster

what we need is a tool or script or API that will perform service check on all ambari services and will print the resulsts as ok or fail

47449-capture.png

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Super Guru

@Michael Bronson,

You can use these curl calls to run all the service checks and check the status

To run service checks

curl -ivk -H "X-Requested-By: ambari" -u {ambari-username}:{ambari-password} -X POST -d @payload.txt http://{ambari-server}:{ambari-port}/api/v1/clusters/{cluster-name}/request_schedules


Sample response:

{
  "resources": [
    {
      "href": "http://<ambari-server>:8080/api/v1/clusters/<clustername>/request_schedules/68",
      "RequestSchedule": {
        "id": 68 // This is the request-schedule-id to be used for second call
      }
    }
  ]
}
<br>

Note: Download the attached payload.txt to some folder and run the above command from the same folder.

To get status of service checks

curl -ivk -H "X-Requested-By: ambari" -u {ambari-username}:{ambari-password} -X GET http://{ambari-server}:{ambari-port}/api/v1/clusters/{cluster-name}/request_schedules/{request-sched...

To get the status of each service, iterate through batch_requests array in the response and look for 'request_status' inside each object.

COMPLETED is for passed, FAILED for failed, ABORTED if service check is aborted.payload.txt

Note: request-schedule-id for the second curl call is obtained from the response of 1st call.

Thanks,

Aditya

View solution in original post

4 REPLIES 4

avatar
Super Guru

avatar

@Aditya , yes I already see that , but we want a tool that will do it more simple , because in the article need to make some configuration for each service , and maybe there is some ready tool that do the job without any addtional work

Michael-Bronson

avatar
Super Guru

@Michael Bronson,

You can use these curl calls to run all the service checks and check the status

To run service checks

curl -ivk -H "X-Requested-By: ambari" -u {ambari-username}:{ambari-password} -X POST -d @payload.txt http://{ambari-server}:{ambari-port}/api/v1/clusters/{cluster-name}/request_schedules


Sample response:

{
  "resources": [
    {
      "href": "http://<ambari-server>:8080/api/v1/clusters/<clustername>/request_schedules/68",
      "RequestSchedule": {
        "id": 68 // This is the request-schedule-id to be used for second call
      }
    }
  ]
}
<br>

Note: Download the attached payload.txt to some folder and run the above command from the same folder.

To get status of service checks

curl -ivk -H "X-Requested-By: ambari" -u {ambari-username}:{ambari-password} -X GET http://{ambari-server}:{ambari-port}/api/v1/clusters/{cluster-name}/request_schedules/{request-sched...

To get the status of each service, iterate through batch_requests array in the response and look for 'request_status' inside each object.

COMPLETED is for passed, FAILED for failed, ABORTED if service check is aborted.payload.txt

Note: request-schedule-id for the second curl call is obtained from the response of 1st call.

Thanks,

Aditya