abajwa-hw / hdpviz

7 stars 6 forks source link

An Ambari Stack for HDP Visualizer for component services

Ambari stack/view for easily installing and managing HDP Visualizer, inspired by Twitter's HDFS du on HDP cluster

cp -R /root/hdpviz/hdpviz_stack /var/lib/ambari-server/resources/stacks/HDP/2.2/services/

IP=$(ifconfig eth0|awk '/inet addr/ {split ($2,A,":"); print A[2]}') sed -i "s/sandbox.hortonworks.com/$IP/g" /root/hdpviz/hdpviz-view/src/main/resources/index.html

cd /root/hdpviz/hdpviz-view mvn clean package cp target/*.jar /var/lib/ambari-server/resources/views

sudo service ambari restart

- Then you can click on 'Add Service' from the 'Actions' dropdown menu in the bottom left of the Ambari dashboard:

On bottom left -> Actions -> Add service -> check HDPVIZ server -> Next -> Next -> Next -> Deploy
![Image](../master/screenshots/screenshot-vnc-config.png?raw=true)

- On successful deployment you will see the HDPVIZ service as part of Ambari stack and will be able to start/stop the service from here:
![Image](../master/screenshots/screenshot-vnc-stack.png?raw=true)

- When you've completed the install process, HDPVIZ will appear in Ambari. You can see the parameters you configured under 'Configs' tab
![Image](../master/screenshots/hdpviz-service.png?raw=true)

- One benefit to wrapping the component in Ambari service is that you can now monitor/manage this service remotely via REST API

export SERVICE=HDPVIZ export PASSWORD=admin export AMBARI_HOST=sandbox.hortonworks.com export CLUSTER=Sandbox

get service status

curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X GET http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE

start service

curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Start $SERVICE via REST"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE

stop service

curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Stop $SERVICE via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE


- To remove the HDPVIZ service: 
  - Stop the service via Ambari
  - Delete the service
curl -u admin:admin -i -H 'X-Requested-By: ambari' -X DELETE http://sandbox.hortonworks.com:8080/api/v1/clusters/Sandbox/services/HDPVIZ
```

Open view

Image