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

Ambari Metrics Collector API not return latest metrics

Explorer

Hello,

I've set up a AMS API call to retrieve Yarn matrix on a minute basis. I tried to add startTime/endTime in my query. Even though I found the metrics returned are not reflecting the latest time stamp, and data is kind of stale. Is there a way I can configure my query so that it can always catch the latest state of the metrics?

Example of my tests:

curl 'http://myhost:6188/ws/v1/timeline/metrics?metricNames=[metricsname]&appId=resourcemanager&startTime=1486410484&endTime=1486410784&precision=SECONDS'

In the return below, I want to see at least the endTime epoch or endTime - 1min epoch, but sometimes it can't get this far.

{u'metrics': [{u'metrics': {u'1486410630000': 0.0, u'1486410570000': 0.0, u'1486410540000': 0.0, u'1486410600000': 0.0, u'1486410510000': 0.0}, u'timestamp': 1486410510000, u'appid': u'resourcemanager', u'starttime': 1486410510000, u'metricname': u'metricsname'}]}

Thanks for the help!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Ambari Metrics Collector API not return latest metrics

Expert Contributor

When a hostname is not specified, AMS returns data aggregated across all hosts/appId that send this metric. The aggregation happens every 2 mins, creating 4 x 30 second aggregates per iteration.

Add the following query parameter to your curl URL.

&hostname=<resourcemanager_host>

This should return most recent data.

View solution in original post

2 REPLIES 2

Re: Ambari Metrics Collector API not return latest metrics

Expert Contributor

When a hostname is not specified, AMS returns data aggregated across all hosts/appId that send this metric. The aggregation happens every 2 mins, creating 4 x 30 second aggregates per iteration.

Add the following query parameter to your curl URL.

&hostname=<resourcemanager_host>

This should return most recent data.

View solution in original post

Re: Ambari Metrics Collector API not return latest metrics

Explorer

Thanks @Aravindan Vijayan for the information. This works.