Forum Discussion

Drelo's avatar
Drelo
Icon for Neophyte rankNeophyte
6 days ago

Performance averages over time

Hi,

I’m currently looking for a way to get averages on certain data points & make that data via the API e.g. Average CPU busy per hour, per device.

I've played around with the following approaches but none of them are really what I'm after:

  1. Looping through datasources, getting devices & looping through instances via “/device/devices/{deviceId}/devicedatasources/{hdsId}/instances/{id}/data”. This approach is too cumbersome for the number of devices we have, combined with the other averages we want to pull.
  2. Creating a graph widget & getting the data via the /dashboard/widgets/{widgetId}/data endpoint. This would work if there wasn't a maximum of 100 devices in the widget & deviceIds were clearly linked the graph data.
  3. Generating a trend report & grabbing the link via /report/links/{reportId}. I haven't written this approach off yet but the available formats & the expiry on the generated link isn't ideal.
  4. Dynamic table data is great via the /dashboard/widgets/{widgetId}/data endpoint but I cannot work out a way create a datapoint that has an hourly average value. I'm not sure if it's possible to do something like grab the last x records for a datasource/datapoint on a device & present them in a different datasource/datapoint that could be used in a table widget or to set a custom property value on the device? 
  • What if you used the script cache to keep a running average of the last hour? Then you'd only be pulling the most recent datapoint per device, either through report or widget data.

    • Drelo's avatar
      Drelo
      Icon for Neophyte rankNeophyte

      Thanks Stuart,
      I kind of came to the same conclusion last night. I've been looking at some of the awesome PS module functions shared by Steve_Villardi . I think I'll try & re-using some of Steve's functions, combined with script cache. This should allow me to set an average usage value datapoint for each metric per device hourly, which I can then add to a dynamic table widget & pull via the widget/data endpoint.