- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to track "HDP installation status using Ambari Blueprints"
- Labels:
-
Apache Ambari
Created 01-11-2016 03:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know we can track installation status using below API call or from directly using Ambari UI.
curl -H "X-Requested-By: ambari" -X GET -u admin:admin http://<ambari-hostname>:8080/api/v1/clusters/<cluster-name>/requests/
Is there any other efficient way to track the status of installation in an automated way ?
Created 01-18-2016 07:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I forked structor to add Blueprints support, I just used the API call in a while loop:
ProgressPercent=`curl -s --user admin:admin -H 'X-Requested-By:mycompany' -X GET http://<ambari-hostname>:8080/api/v1/clusters/<cluster-name>/requests/1 | grep progress_percent | awk '{print $3}' | cut -d . -f 1` echo " Progress: $ProgressPercent" while [[ `echo $ProgressPercent | grep -v 100` ]]; do ProgressPercent=`curl -s --user admin:admin -H 'X-Requested-By:mycompany' -X GET http://<ambari-hostname>:8080/api/v1/clusters/<cluster-name>/requests/1 | grep progress_percent | awk '{print $3}' | cut -d . -f 1` tput cuu1 echo " Progress: $ProgressPercent %" sleep 2 done echo "Cluster build is complete."
Created 01-11-2016 05:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you can use command line tools like pdsh or some configuration management tool like ansible and tail /var/log/messages for installed RPMs, alternatively, you can run command ps aux | grep yum and see what's being installed as well.
Created 01-11-2016 05:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Kuldeep Kulkarni you can also poke around in the ambari database for status installed but that's essentially the same as using API only much more intrusive.
Created 01-18-2016 07:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I forked structor to add Blueprints support, I just used the API call in a while loop:
ProgressPercent=`curl -s --user admin:admin -H 'X-Requested-By:mycompany' -X GET http://<ambari-hostname>:8080/api/v1/clusters/<cluster-name>/requests/1 | grep progress_percent | awk '{print $3}' | cut -d . -f 1` echo " Progress: $ProgressPercent" while [[ `echo $ProgressPercent | grep -v 100` ]]; do ProgressPercent=`curl -s --user admin:admin -H 'X-Requested-By:mycompany' -X GET http://<ambari-hostname>:8080/api/v1/clusters/<cluster-name>/requests/1 | grep progress_percent | awk '{print $3}' | cut -d . -f 1` tput cuu1 echo " Progress: $ProgressPercent %" sleep 2 done echo "Cluster build is complete."
Created 03-31-2016 01:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This approach should work fine, but I would suggest a refinement that may improve performance somewhat, and will also make the returned status play load quite a bit smaller in size:
If you use the partial response syntax provided in the Ambari REST API, you can filter out much of the data returned in the request resource returned by the call listed above.
An example of using the partial response syntax is below:
The "fields" query parameter is used to limit the fields returned from the request resource. The fields I've mentioned here are the set I use, but you can also check the other properties returned by the resource, if a particular property is more straightforward to use for this type of monitoring.
I use this syntax quite a bit when I want to monitor the status of a Blueprint deployment.
Created 05-26-2016 06:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I wrote a python script that does the same thing. I noticed that immediately after I install the cluster hostmap to kickstart the install, and then check the request it returns, I get a 100% `progress_percent`. I had to introduce a delay (I set it to 5 seconds) before I start polling the request API.
Created 05-26-2016 07:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This recently started happening in my scripts too and I hadn't figured out why. Thanks for the tip!
Created 06-10-2016 12:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you want to use a standard tool rather than managing the API/HTTP calls via scripts, you can use Ansible.
We've enabled such a feature on the Rackspace deployment playbooks: https://github.com/rackerlabs/ansible-hadoop/blob/master/playbooks/roles/ambari-server/tasks/main.ym...
I've create a gist only for that function: https://gist.github.com/alexandruanghel/68a16994028563be12cee4e3b93f7e89 if you want to use it straight away.
So once you download the statuscheck.yml just set the variables and run it:
AMBARI_HOST=127.0.0.1 AMBARI_PASSWORD=admin CLUSTER_NAME=hadoop-poc ansible-playbook -e "ansible_nodename=$AMBARI_HOST cluster_name=$CLUSTER_NAME ambari_password=$AMBARI_PASSWORD wait_timeout=1800" statuscheck.yml