Created 05-08-2017 08:35 PM
Team,
I want to read Ambari alerts through NIFI using REST API's . Please let me know if its feasible to do it .
Created on 05-09-2017 05:16 AM - edited 08-17-2019 06:47 PM
Based on the thread title you want to know how to get components status (running,stopped) from ambari REST API's?
However later you mentioned that "you want to read Ambari alerts through NIFI using REST API's", Can you please clarify which alert are you getting and Are you sure that you want to read the component status from Alerts?
- If you simply want to read the component status (like NIFI) then you can make the following kind of REST Curl call:
curl -u admin:admin -H "X-Requested-By:ambari" -i -X GET http://localhost:8080/api/v1/clusters/Sandbox/hosts/sandbox.hortonworks.com/host_components/NIFI_MAS...
.
OR more precisely
curl -u admin:admin -H "X-Requested-By:ambari" -i -X GET http://localhost:8080/api/v1/clusters/Sandbox/hosts/sandbox.hortonworks.com/host_components/NIFI_MAS...
Example output will be something like:
.
Created 05-08-2017 10:38 PM
Yes, you can get component status using ambari Rest API's.
curl -u admin:admin -H "X-Requested-By:ambari" -i -X POST http://sandbox.hortonworks.com:8080/api/v1/clusters/Sandbox/services/NIFI
Below is a good article:
Created 05-09-2017 01:54 AM
@Namit Maheshwari when I try the above .. its actually creating the service . Please find below the status I got from curl function .
curl -u admin:'XXXX' -H "X-Requested-By:ambari" -i -X POST http://XXXX:8080/api/v1/clusters/HDF_DEV/services/NIFI HTTP/1.1 409 Conflict X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Set-Cookie: AMBARISESSIONID=1rb3hvd20fc9g1rcuezfvw84fg;Path=/;HttpOnly Expires: Thu, 01 Jan 1970 00:00:00 GMT User: admin Content-Type: text/plain Content-Length: 128 Server: Jetty(8.1.19.v20160209)
{ "status" : 409, "message" : "Attempted to create a service which already exists: , clusterName=HDF_DEV serviceName=NIFI"
I was thinking to use nifi and check all the services for HDP components .
Created on 05-09-2017 05:16 AM - edited 08-17-2019 06:47 PM
Based on the thread title you want to know how to get components status (running,stopped) from ambari REST API's?
However later you mentioned that "you want to read Ambari alerts through NIFI using REST API's", Can you please clarify which alert are you getting and Are you sure that you want to read the component status from Alerts?
- If you simply want to read the component status (like NIFI) then you can make the following kind of REST Curl call:
curl -u admin:admin -H "X-Requested-By:ambari" -i -X GET http://localhost:8080/api/v1/clusters/Sandbox/hosts/sandbox.hortonworks.com/host_components/NIFI_MAS...
.
OR more precisely
curl -u admin:admin -H "X-Requested-By:ambari" -i -X GET http://localhost:8080/api/v1/clusters/Sandbox/hosts/sandbox.hortonworks.com/host_components/NIFI_MAS...
Example output will be something like:
.
Created 05-09-2017 03:16 PM
@Jay SenSharma Hi Jay.. Thanks for the details .. this is what I am looking for.
Created 05-09-2017 03:37 PM
Good to know that the detail was useful.
It will be great if you can click on the "Accept" link on this thread and mark this thread as "Answered", that will be useful for other users as well.