#What is the most optimal way to get CPU and related metrics of ontap at a given time using Rest API
1 messages · Page 1 of 1 (latest)
@oak sail How about this CLI Pass?
https://CLUSTER_IP/api/private/cli/node?fields=cpu_busy_time
@latent mauve what am I doing wrong here?
$ curl -X GET -u $CREDS -k "https://$IP/api/private/cli/node?fields=cpu_busy_time,cpu_elapsed_time"
{
"error": {
"message": "The value \"cpu_elapsed_time\" is invalid for field \"fields\" (<field,...>)",
"code": "262197",
"target": "fields"
}
@odd orchid cpu_elapsed_time is not available via CLI Pass. However, if you are using Harvest, you can obtain this information by using node_cpu_elapsed_time https://netapp.github.io/harvest/23.05/ontap-metrics/#node_cpu_elapsed_time
and node_cpu_busytime
https://netapp.github.io/harvest/23.05/ontap-metrics/#node_cpu_busytime
got it, thank you Rahul!
@latent mauve Thank you! I believe this is a point in time value. So may be collecting this value for a couple times in several minutes might give an idea if the cpu is loaded or not, I hope. Unless you have a better advice at hand!
@oak sail Yes this value needs to be collected over a time range to understand it. Harvest (https://github.com/NetApp/harvest) utilizes the following metrics to gather this data as a percentage, as depicted in the attached screenshot.
https://netapp.github.io/harvest/23.05/ontap-metrics/#node_cpu_busy
https://netapp.github.io/harvest/23.05/ontap-metrics/#node_avg_processor_busy
@oak sail you can think of the calculation like this: imagine you have two time periods, t0 (now) and t1 (a few seconds from now). In order to calculate CPU utilization over that time, you would use this formula:
cpu utilization % = (cpu_busy_t1 - cpu_busy_t0) * 100 / (cpu_elapsed_time_t1 - cpu_elapsed_time_t0)