Created
December 21, 2018 22:03
-
-
Save OneCricketeer/a5a3da1fdd07954d0440934bb2a6aa81 to your computer and use it in GitHub Desktop.
Ambari API samples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
: ${AMBARI_API:=http://localhost:8080} | |
curl --silent --request GET \ | |
--url "${AMBARI_API}/api/v1/clusters/little_data/hosts?fields=Hosts/rack_info' \ | |
--header 'X-Requested-By: ambari' \ | |
--header 'Accept: application/json, text/javascript, */*; q=0.01' \ | |
--header 'cache-control: no-cache' | jq '.items[].Hosts.rack_info' | sort | uniq -c | |
### Sample output | |
# 7 "/rack1" | |
# 4 "/rack2" | |
# 5 "/rack3" | |
# 7 "/vmware" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment