Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Not able to retrieve average load Ambari metric using API

avatar
Expert Contributor

I am trying to run some test API calls on HDP Sandbox 2.4 with Ambari 2.2.1.0 and facing some issues. Here is the call API call I am making.

http://localhost:8080/api/v1/clusters/Sandbox?fields=metrics/load[1462233600,1462406399]&_=1462328977

and all I am getting in return is

{
  "href" : "http://localhost:8080/api/v1/clusters/Sandbox?fields=metrics/load[1462233600,1462406399]&_=1462328977",
  "Clusters" : {
    "cluster_name" : "Sandbox",
    "version" : "HDP-2.4"
  }

Would appreciate any help here.

1 ACCEPTED SOLUTION

avatar

@Kashif Khan

Make sure your Ambari Metrics service is running and that it was running for the time period for which you are trying to request data. On my Sandbox, the Metrics service was shut down. When I started it, the query still didn't return anything because there was no data available to return. When there is data, you will still get the header that you are getting plus the data points. Here is what I get on a different cluster:

{
  "href" : "https://localhost:8443/api/v1/clusters/SMESecurityTEST?fields=metrics/load[1462233600,1462406399]&_=1462350240",
  "Clusters" : {
    "cluster_name" : "SMESecurityTEST",
    "version" : "HDP-2.4"
  },
  "metrics" : {
    "load" : {
      "1-min" : [
        [
          0.0,
          1462233600
        ],
        [
          0.3094347587719297,
          1462234576
        ],
        [
          0.32168695175438616,
          1462238176
        ],
        [
          0.433827850877193,
          1462241776
        ],

---truncated----

View solution in original post

2 REPLIES 2

avatar

@Kashif Khan

Make sure your Ambari Metrics service is running and that it was running for the time period for which you are trying to request data. On my Sandbox, the Metrics service was shut down. When I started it, the query still didn't return anything because there was no data available to return. When there is data, you will still get the header that you are getting plus the data points. Here is what I get on a different cluster:

{
  "href" : "https://localhost:8443/api/v1/clusters/SMESecurityTEST?fields=metrics/load[1462233600,1462406399]&_=1462350240",
  "Clusters" : {
    "cluster_name" : "SMESecurityTEST",
    "version" : "HDP-2.4"
  },
  "metrics" : {
    "load" : {
      "1-min" : [
        [
          0.0,
          1462233600
        ],
        [
          0.3094347587719297,
          1462234576
        ],
        [
          0.32168695175438616,
          1462238176
        ],
        [
          0.433827850877193,
          1462241776
        ],

---truncated----

avatar
Expert Contributor

Thanks Maxwell. I was using 2 days date range whereas data was only available for few hours. I was thinking it will still respond with whatever data it has. Now I ran with 2 mins range and it came back with metrics. However, this data looks very granular. Couple of questions for you:

  • Is there a way to get 15 mins aggregate kind of metrics? Right now, it looks like every 30 second data is available.
  • What is the use of last parameter in query (i.e. current timestamp)
  • How does the step param(last parameter in date range query) work in time range query.