#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
#

I could not find the best API end point that matched the command “system statistics” to get the CPU and such metrics of the nodes at a given point. Tried to do CLI pass through but the parameters wasn’t clear to me and I kept getting errors that the API endpoint doesn’t exist, Advice is appreciated.

latent mauve
#

@oak sail How about this CLI Pass?
https://CLUSTER_IP/api/private/cli/node?fields=cpu_busy_time

odd orchid
#

@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"
  }
latent mauve
odd orchid
#

got it, thank you Rahul!

oak sail
#

@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!

latent mauve
odd orchid
#

@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)