Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

how to verify if some service installed on ambari cluster by API

avatar

we want to know if service exist in ambari cluster by API

is any way to know that? by API

for example - we want to know if KAFKA service exsist in ambari cluster

Michael-Bronson
1 ACCEPTED SOLUTION

avatar

@Michael Bronson Perhaps you can use services rest api to check like this:

curl -iv -u admin -X GET http://AMBARI_HOST:8080/api/v1/clusters/CLUSTER_NAME/services/KAFKA

If service is not installed you will received a response indicating resource does not exist.

HTH

*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.

View solution in original post

5 REPLIES 5

avatar
Expert Contributor

Following call we do, if kafka does not exist you will get status 404.

curl --user admin -sS -G "http://ambari_server_here/api/v1/clusters/CLUSTERNAME_HERE/services/KAFKA"

API resource:

https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md

avatar

this API withpout passord ?

Michael-Bronson

avatar

how to add the password - admin in the API?

Michael-Bronson

avatar

@Michael Bronson Perhaps you can use services rest api to check like this:

curl -iv -u admin -X GET http://AMBARI_HOST:8080/api/v1/clusters/CLUSTER_NAME/services/KAFKA

If service is not installed you will received a response indicating resource does not exist.

HTH

*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.

avatar

@Michael Bronson For the password you need to send the basic authorization header like this

-H 'Authorization: Basic XXXXXXX'

Following link shows how to create the header using most popular languages:

https://gist.github.com/brandonmwest/a2632d0a65088a20c00a

HTH