...
Following is an illustration of an API call that fetches metrics from the Metrics backend service using Ambari API at the aforementioned levels.
CLUSTER
E.g.: Dashboard metrics : Fetch load average across all nodes of a cluster
http://<ambari-server>:8080/api/v1/clusters/<cluster-name>/?fields=metrics/load[1430844925,1430848525,15]&_=1430848532904 |
---|
...
http://<ambari-server>:8080/api/v1/clusters/<cluster-name>/hosts/<host-name>?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 |
---|
...
http://<ambari-server>:8080/api/v1/clusters/<cluster-name>/services/HDFS/components/DATANODE?fields=metrics/dfs/datanode/DfsUsed,metrics/dfs/datanode/Capacity&_=1430849798630 |
---|
...
E.g.: Daemon metrics: Get the heap memory usage for a datanodeactive Namenode
http://<ambari-server>:8080/api/v1/clusters/<cluster-name>/hosts/<host-name>/host_components/NAMENODE?fields=metrics/jvm/memHeapCommittedM[1430847303,1430850903,15],metrics/jvm/memHeapUsedM[1430847303,1430850903,15]&_=1430850903846 |
---|
The above API call retrieves JVM heap metrics for the Active Namenode in the cluster.
The request part of the api selects the Namenode host component while predicate part includes metrics with time range query.
Metric definition - Stack driven