Support Questions

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

I would to write a script which will check the status of Hivserver2 is running or not.

avatar
Explorer

I would to write a script which will check the status of Hivserver2 is running or not. I would like to connect beeline and show databases. if i get the output then Hiveserver 2 is running. Can any one help in writing the script for this ?

1 ACCEPTED SOLUTION

avatar
Expert Contributor

You can query the API exposed by Cloudera Manager and simplify your life. For example, you can run the following:

 

curl -u <CM_USER>:<CM_PASSWD> http://<CM_IP_ADDRESS>:7180/api/v19/clusters/<CLUSTER_NAME>/services/hive2

 

You'll get a Json answer in reply to your Query, with all the details related to the desired service's status. You can finally parse your Json answer (e.g. using "jq" or directly inside your bash script) and take the desired actions

 

HTH

View solution in original post

1 REPLY 1

avatar
Expert Contributor

You can query the API exposed by Cloudera Manager and simplify your life. For example, you can run the following:

 

curl -u <CM_USER>:<CM_PASSWD> http://<CM_IP_ADDRESS>:7180/api/v19/clusters/<CLUSTER_NAME>/services/hive2

 

You'll get a Json answer in reply to your Query, with all the details related to the desired service's status. You can finally parse your Json answer (e.g. using "jq" or directly inside your bash script) and take the desired actions

 

HTH