01 Nov 2022 12:50 PM - last edited on 02 Nov 2022 02:55 AM by MaciejNeumann
I've read the documentation for retrieving license consumption via API but the endpoint "/api/cluster/v2/license/consumption/hour" only retrieves the latest hour.
Is there a way to edit the URL to retrieve data for the last say week/month/year?
In the example provided in the documentation, you can specify a starting timestamp. Are there other parameters you can filter for?
I know I can export the data but that's in a zip file and I prefer to have updated data.
PS: I'm a beginner at this stuff any help is appreciated
Solved! Go to Solution.
What is your scope? are you looking for overall consumption? Hosts/entities individually?
Individual entity consumption
If you are on managed - the most precise method is to use the data in the zip file.
For individual environment or saas I use this script to push license metric bound to individual hosts. It uses the /api/v1/oneagents API to pull consumption and then push the metric value back to the environment. Then you have the license metric in your environment and you can report consumption simply using Data Explorer by filtering on hosts or management zones as you prefer.
Also, the recent version notifies you if some of your hosts are disabled due to overconsumption.
The consumption data in the zip file is actually not correct. It often outputs wrong hostunit / consumption values, or at least it used to. That's one of the reasons we couldn't use it. In a support case I was told I am not to rely on that data - so I would not.
Same with the consumedHostUnits value in the API, this often does not reflect the real value. That was an issue since we have to get the costs of individual hosts for our actual accounting.
That may be fixed by now, it was a year ago, but that was an issue for us internally.
We ended up writing a script taking the paasMemoryLimit / zosTotalPhysicalMemory and applying the calculations ourselves depending on the mode the hosts (infrastructure, fullstack).
03 Nov 2022 12:16 AM - last edited on 16 Dec 2022 12:42 AM by Ana_Kuzmenchuk
We never had issues with either the zip file or the API (OneAgent API). Both are reporting correct host units. I'd stay away from calculating that on your own unless you know the details such as memory tolerance. (Yes there is some tolerance).
We didn't, and I even have a support call which confirms that, even with a statement made we are not to rely on that data. I'd have to re-check that though if that situation changed. We actually implemented the calculation ourselves because of that.
I am looking for Hosts/entities individually in the SAAS environment.