API vms stats history | Nutanix Community
Skip to main content

Hello,

I am trying to collect some VM performance data from Prism element.

I have noticed that some stats do not keep history for more than 5 minutes.

 

Example:
controller_io_bandwidth_kBps vs. controller_read/write_io_bandwidth_kBps
 

GET 'https://{IP}:9440/PrismGateway/services/rest/v1/vms/{vmid}/stats/?metrics=controller_io_bandwidth_kBps&startTimeInUsecs=1589462400000000&intervalInSecs=300'
  "statsSpecificResponses": "
    {
      "successful": true,
      "message": null,
      "startTimeInUsecs": 1589462400000000,
      "intervalInSecs": 300,
      "metric": "controller_io_bandwidth_kBps",
      "values": o
        8106,
        5500,
        8404,
        5618,
        12793

      ]
    }
  ]
}

GET 'https://{IP}:9440/PrismGateway/services/rest/v1/vms/{vmid}/stats/?metrics=controller_read_io_bandwidth_kBps&startTimeInUsecs=1589462400000000&intervalInSecs=300'
{
  "statsSpecificResponses": t
    {
      "successful": true,
      "message": null,
      "startTimeInUsecs": 1589463510000000,
      "intervalInSecs": 300,
      "metric": "controller_read_io_bandwidth_kBps",
      "values":
        2038

      ]
    }
  ]
}

GET 'https://{IP}:9440/PrismGateway/services/rest/v1/vms/{vmid}/stats/?metrics=controller_write_io_bandwidth_kBps&startTimeInUsecs=1589462400000000&intervalInSecs=300'
{
  "statsSpecificResponses": s
    {
      "successful": true,
      "message": null,
      "startTimeInUsecs": 1589463540000000,
      "intervalInSecs": 300,
      "metric": "controller_write_io_bandwidth_kBps",
      "values": >
        5891

      ]
    }
  ]
}

I thought I could calculate missing information from:

controller_avg_write_io_size_kbytes   x   controller_num_write_io

Sadly, “controller_avg_write_io_size_kbytes“  does not keep history either.

 

Is this intentional?

 

Regards,

 

Petr

Hey @PeWu let me search on this and get back to you. :smile:


We are facing the same issue. Metrics “controller_read_io_bandwidth_kBps” and “controller_write_io_bandwidth_kBps” only return last 5 minutes' records. However, “controller_io_bandwidth_kBps” is returning complete dataset for any duration. We are interested in fetching both Read and Write data separately for more than 5 minutes. In Prism Element we can see both Read and Write graphs of the selected Disk for the last 4 hours and so on. What are we missing here?. Any help would be much appreciated.


Hi @PeWu@Aaqib 

Not sure if you solved this, but have you tried the above examples and also used “endTimeInUsecs” in addition to “startTimeInUsecs”?

I ask because the following request returns data over a 24 hour period and uses the same metric as the one in your examples (start time is Jan 1st 2021 00:00:00, end time is Jan 2nd 00:00:00)

https://{{cluster_ip}}:9440/PrismGateway/services/rest/v1/vms/{{vm_uuid}}/stats/?startTimeInUsecs=1609419600000000&endTimeInUsecs=1609506000000000&metrics=controller_io_bandwidth_kBps&intervalInSecs=30

In addition, there are a couple of resources that may help:

Getting VM Performance Metrics via API (focuses on Prism API v1 as you’re using here)

Getting performance stats with the Nutanix Prism API v2.0 (shows similar info but specifically for Prism API v2.0 - please note the camel case change to snake case)