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

Ambari metrics storage and API

Rising Star

Hi,

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": 
"sandbox.hortonworks.com", "timestamp": 1498569374758, "starttime": 
1498569374758, "metrics": {"1498569374758": 0.963781711428, 
"1498569376758": 1432075898000}}]}' 
"http://127.0.0.1:6188/ws/v1/timeline/metrics"

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 
"http://127.0.0.1:6188/ws/v1/timeline/metrics?metricNames=MyMetric&appId=amssmoketestfake&hostname=sandbox.hortonworks.com"&startTime=1498569373758&endTime=1498569377758

Result : {"metrics":[{"timestamp":1498569214725,"metadata":{},"metricname":"MyMetric","appid":"amssmoketestfake","hostname":"sandbox.hortonworks.com","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...

2 REPLIES 2

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

https://cwiki.apache.org/confluence/display/AMBARI/Metrics+Collector+API+Specification

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