Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 08-14-2018 04:47 AM
Say, for last 5 minutes what is the cpu usage for 5 minutes averaged across all nodes in the cluster?
I can see that in Ambari, but I want information in the given time range and I should be able to get that information with an API call.
Created 08-14-2018 07:31 AM
Hi @naveen r
If you have ambari metrics installed you can do this with REST API. For example;
curl -u admin:admin -H 'X-Requested-By:ambari' -X GET "https//localhost:8080/api/v1/clusters/<your cluster name>/?fields=metrics/load/CPUs._avg[1534230000,1534231500,15]"
Note that ;
CPUs._avg[X,Y,15]
X = start time, Y = end time, 15 = step value used for zero padding or null padding
More examples and official documentation on:
https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Metrics+API+specification
Created 08-14-2018 07:31 AM
Hi @naveen r
If you have ambari metrics installed you can do this with REST API. For example;
curl -u admin:admin -H 'X-Requested-By:ambari' -X GET "https//localhost:8080/api/v1/clusters/<your cluster name>/?fields=metrics/load/CPUs._avg[1534230000,1534231500,15]"
Note that ;
CPUs._avg[X,Y,15]
X = start time, Y = end time, 15 = step value used for zero padding or null padding
More examples and official documentation on:
https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Metrics+API+specification
Created 08-14-2018 08:24 AM
How do I get the memory usage avg.?
Created 08-14-2018 08:39 AM
There are a variety of options for memory. I just tried the same for my cluster and using for example fields=metrics/memory/Use._avg[1534235091,1534235391,15] worked well.
Further options quoted from the source code;
/clusters/{clusterName}/?fields=metrics/memory/Buffer._avg[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/Cache._avg[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/Share._avg[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/Swap._avg[{fromSeconds},{toSeconds},{stepSeconds}],
metrics/memory/Total._avg[{fromSeconds},{toSeconds},{stepSeconds}], metrics/memory/Use._avg[{fromSeconds},{toSeconds},{stepSeconds}]',