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:
- 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.
- 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.
- 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.
- 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?
Drelo
3 comments
LM User
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
OPThanks 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.
Drelo
OPManaged to get back to looking at this today. It's an ugly first pass with no debugging or error checking but it appears to validate the approach (I imported more modules that needed :-)). The output lets me set a datapoint for CPU hourly average, I can then present in a dynamic table widget & pull all associated device's avg CPU data in one API call via the /dashboard/widgets/{widgetId}/data endpoint.