Support Questions

Find answers, ask questions, and share your expertise

REST API + how to get the number of CPU on each data node

avatar

hi all

how to get the number of CPU on each data node by REST API?

I also tried this but get error about:

[root@master02 ~]#  curl -u admin:admin -sS -G "https://master02:8080/api/v1/clusters/HDP/services/HDFS/components/DATANODE" 
curl: (35) SSL received a record that exceeded the maximum permissible length.
Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Master Mentor

@Michael Bronson

You can try making the following kind of API call:

# curl -H "X-Requested-By: ambari" -u admin:admin -X GET "http://newhwx1.example.com:8080/api/v1/clusters/NewCluster/hosts?fields=Hosts/host_name,Hosts/public_host_name,Hosts/cpu_count&host_compnents/HostRoles/component_name.in(DATANODE)"

.

Please replace the following (in addition to cre4dentials)

newhwx1.example.com:8080 => Ambari Server URL

NewCluster => Your ClusterName

.

Also if you are running your Abari Server on "HTTPS" secure port then please make sure that you are are appending "-k" in the curl command like:

# curl -k -H "X-Requested-By: ambari"  ......

.

View solution in original post

2 REPLIES 2

avatar
Master Mentor

@Michael Bronson

You can try making the following kind of API call:

# curl -H "X-Requested-By: ambari" -u admin:admin -X GET "http://newhwx1.example.com:8080/api/v1/clusters/NewCluster/hosts?fields=Hosts/host_name,Hosts/public_host_name,Hosts/cpu_count&host_compnents/HostRoles/component_name.in(DATANODE)"

.

Please replace the following (in addition to cre4dentials)

newhwx1.example.com:8080 => Ambari Server URL

NewCluster => Your ClusterName

.

Also if you are running your Abari Server on "HTTPS" secure port then please make sure that you are are appending "-k" in the curl command like:

# curl -k -H "X-Requested-By: ambari"  ......

.

avatar

@Jay chould you please help me with the follwing thred - https://community.hortonworks.com/questions/226622/rest-api-how-to-verify-the-max-value-for-each-par...

Michael-Bronson