Support Questions
Find answers, ask questions, and share your expertise

Ambari metrics storage and API

Rising Star


I'm trying to understand ambari metrics API but cannot understand what data is stored/returned by the server with followings : First, I post new metric data with 2 values at t0 & t0 + 2s :

curl -H "Content-Type: application/json" -X POST -d '{"metrics": 
[{"metricname": "MyMetric", "appid": "amssmoketestfake", "hostname": 
"", "timestamp": 1498569374758, "starttime": 
1498569374758, "metrics": {"1498569374758": 0.963781711428, 
"1498569376758": 1432075898000}}]}' 

If I try to request this metric with a GET request, here what AMS returns to me :

curl -H "Content-Type: application/json" -X GET 

Result : {"metrics":[{"timestamp":1498569214725,"metadata":{},"metricname":"MyMetric","appid":"amssmoketestfake","hostname":"","starttime":1498569374758,"metrics":{"1498569376758":1.432075898E12}}]} Why AMS does not return the 2 values for MyMetric when I explicitely define the timeframe in the GET request ?

I would expect to get all the values for the timestamps between the boundaries ...

Thanks for your help...


Rising Star

In other words, I would like to figureout if all values are stored somewhere and AMS aggregates those values when a client requests for some metrics or is there an aggregation step when AMS receive new values for a metric ?

Is this possible to retrieve several values for a metric in a single REST GET call ? I tried out to run the exact same requests as described in

(2 values separated by 1s interval), but I never got 2 values when sending my GET request...Did someone ran this example successfully ?

Rising Star

Well, nobody knows apparently...Will give a try to another component because ambari metrics documentation is definitely not at the right maturity level.