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]

Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Ambari metric for CPU load for each node and overall?

avatar
Visitor

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?

1 ACCEPTED SOLUTION
5 REPLIES 5

avatar

Below is one example for custom metrics in Ambari:

http://stackoverflow.com/questions/36268745/custom-metrics-in-ambari

avatar
Master Guru

avatar
Visitor

This looks to be what I need, I see the CPU call there for the host, thank you 🙂

avatar
Visitor

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]"

avatar
Super Collaborator

@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.