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 04-05-2017 06:35 PM
I devised a simple Python program to report CPU load average at stock intervals. However, it would be much better if I could pull this info via REST API, Grafana, or otherwise. We need to monitor our own CPU load, and not rely on external monitoring software for our organization, which is not fit for this sort of thing.
Documentation, api calls, examples?
Created 04-06-2017 03:53 AM
Created 04-05-2017 11:34 PM
Below is one example for custom metrics in Ambari:
http://stackoverflow.com/questions/36268745/custom-metrics-in-ambari
Created 04-06-2017 03:53 AM
Ambari metrics API docs - https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Metrics+API+specification
Created 04-06-2017 11:58 AM
This looks to be what I need, I see the CPU call there for the host, thank you 🙂
Created 04-06-2017 12:14 PM
I tried the cpu host call, but it gives me:
curl: (3) [globbing] error: bad range specification after pos 101
And yes, I know the below is an old Unix date, which I did replace with something like
Start:1491309675 ("04/04/2017 08:41:15")
End: 1491481119 (Thu Apr 6 08:18:31 EDT 2017)
I'm not sure what the 15 signifies, or the end '&_=1430848217591'
[mtdeguzis@HOST ~]$ curl -k -H "X-Requested-By: ambari" -u <MYUSERNAME> -X GET <a href="http://<AMBARI_HOST>http://:api/v1/clusters//hosts/?fields=metrics/cpu/cpu_user[1430844610,1430848210,15],metrics/cpu/cpu_wio[1430844610,1430848210,15],metrics/cpu/cpu_nice[1430844610,1430848210,15],metrics/cpu/cpu_aidle[1430844610,1430848210,15],metrics/cpu/cpu_system[1430844610,1430848210,15],metrics/cpu/cpu_idle[1430844610,1430848210,15]&_=1430848217591</a>>:<PORT>api/v1/clusters/<CLUSTER_NAME>/hosts/<TARGET_HOST>?fields=metrics/cpu/cpu_user[1430844610,1430848210,15],metrics/cpu/cpu_wio[1430844610,1430848210,15],metrics/cpu/cpu_nice[1430844610,1430848210,15],metrics/cpu/cpu_aidle[1430844610,1430848210,15],metrics/cpu/cpu_system[1430844610,1430848210,15],metrics/cpu/cpu_idle[1430844610,1430848210,15]&_=1430848217591
curl -k -H "X-Requested-By: ambari" -u mtdeguzis -X GET "http://<AMBARI_HOST>:<PORT>/api/v1/clusters/<CLUSTER_NAME>/hosts/<TARGET_HOST>?fields=metrics/cpu/cpu_user[1491309675,1491481119,15]"
Created 04-06-2017 06:59 PM
@Michael DeGuzis If your cluster has Ambari Metrics Service deployed, then I would suggest using the reference - https://cwiki.apache.org/confluence/display/AMBARI/Metrics+Collector+API+Specification. It is richer and gives you more control on the data you need to fetch.