Support Questions

Find answers, ask questions, and share your expertise

Ambari metric for CPU load for each node and overall?

Explorer

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

Super Guru
5 REPLIES 5

Below is one example for custom metrics in Ambari:

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

Super Guru

Explorer

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

Explorer

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

Expert Contributor

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

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.