Support Questions

Find answers, ask questions, and share your expertise
Announcements
Welcome to the upgraded Community! Read this blog to see What’s New!

Invoke smoke test and get status using Ambari API

avatar
Super Guru

Is there any way to invoke the smoke test for different HDP components using Ambari API ? also can we check the status of smoke test using API ?

1 ACCEPTED SOLUTION

avatar
Contributor

Yes, there is a POST API call. Check this link for an example - Running-Service-Checks

The above would return a requestID

You can then track (poll) the status of the service check request using a GET call by passing the requestID returned from above call. Something like below:

http://c6401.ambari.apache.org:8080/api/v1/clusters/cl1/requests/<requestID>;

View solution in original post

2 REPLIES 2

avatar
Contributor

Yes, there is a POST API call. Check this link for an example - Running-Service-Checks

The above would return a requestID

You can then track (poll) the status of the service check request using a GET call by passing the requestID returned from above call. Something like below:

http://c6401.ambari.apache.org:8080/api/v1/clusters/cl1/requests/<requestID>;

avatar
Super Guru

Thank you so much @vsharma

here is the test results

Smoke test

[root@sandbox ~]# curl -u admin:admin -i -H 'X-Requested-By: ambari' -X POST -d '{"RequestInfo": {"context" :"YARN Service Check","command":"YARN_SERVICE_CHECK"},"Requests/resource_filters":[{"service_name":"YARN"}]}' http://127.0.0.1:8080/api/v1/clusters/Sandbox/requestsHTTP/1.1 202
AcceptedUser: adminSet-Cookie:
AMBARISESSIONID=1vg24zix87lkmi53hpjl4krvk;Path=/;HttpOnlyExpires: Thu, 01 Jan
1970 00:00:00 GMTContent-Type:
text/plainVary:
Accept-Encoding, User-AgentContent-Length: 137Server:
Jetty(8.1.17.v20150415){  "href" : "http://127.0.0.1:8080/api/v1/clusters/Sandbox/requests/87",  "Requests" : {  "id" : 87,  "status" : "Accepted"  }}[root@sandbox ~]#

Track status of above smoke test

curl -u admin:admin -i -H 'X-Requested-By: ambari' -X GET http://127.0.0.1:8080/api/v1/clusters/Sandbox/requests/87

Note - request number can be found from http://127.0.0.1:8080/api/v1/clusters/Sandbox/requests url, we should pickup the last request id to check the status.

Labels