Extract haState from the ResourceManager REST API’s response

I have used jq[https://stedolan.github.io/jq/] command line JSON processor to process the clusterInfo JSON response and extract the haState value from it.

If the JSON is stored in a file, then you could use the below script. Make sure that you install jq package first.

jq '.clusterInfo.haState' clusterInfo.json

If you want to access the service and parse the response on the fly, then use the below CURL command

curl 'http:///ws/v1/cluster/info' | jq -r '.clusterInfo.haState' 


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s