Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

API + how to know by API command all machines in ambari cluster

how to know by API command all machines in ambari cluster ,

example - master01,master02,master03,worker01,worker02,worker03,kafka01,kafka02 etc

Michael-Bronson
1 ACCEPTED SOLUTION

Guru
2 REPLIES 2

Guru

Super Collaborator

You can get the JSON response.

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

http://ambari-server:8080/clusters/:clusterName/hosts

To extract the hostnames easier, you could try JSONPath

$.items[*].Hosts.host_name

Or Python with Requests library

r = requests.get('...')
hosts = ','.join(x['Hosts']['host_name'] for x in r.json()['items'])
Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.