- Print
- DarkLight
How To: Get the Total Cost Report for Managed Clusters
Article summary
Did you find this summary helpful?
Thank you for your feedback!
After deploying the RealTheory collector to a Kubernetes cluster (See Installing RealTheory in a Cluster), the cluster and its associated objects become available in the RealTheory API within minutes.
Get Total Cost Report
To get the Total Cost report data for all clusters, call the method below on the K8sReports endpoint.
GET <endpoint>/theory/api/v1/k8sreports/totalcostreport/clusters/{offset}/{span}?index={index}&count={count}&order={order}&direction={direction}
where
{endpoint}
- is the URL of the RealTheory SaaS portal for your account.{offset}
- is an offset from the current time, in a human readable format, that represents the start of the report data. Supported examples include '24h', '7d', '31d', '365d'{span}
- a span of time, in a human readable format, to include in the report data. Supported examples include '24h', '7d', '31d', '365d'{index}
- is the starting index of the rows to include in the list. This parameter is optional and defaults to 0 if not specified.{count}
- is maximum number of rows to return. This parameter is optional and defaults to 100 if not specified.{order}
- is a string containing the name of the attribute to sort on. This parameter is optional. Default value is totalCost.{direction}
- is a number that controls the direction of the sort. A value equal to or greater than 0 indicates ascending order; a value less than 0 indicates descending order. This parameter is optional and defaults to 0 if not specified.
Note: All calls to RealTheory APIs must be authenticated and authorized. See Authentication for more details.
Example
GET myendpoint.realtheory.io/theory/api/v1/k8sreports/totalcostreport/clusters/365d/365d?index=0&count=100&order=totalCost&direction=-1
which returns the first 100 rows for the Cluster Total Cost report for the last 365 days, sorted by the clusters with the highest total costs to the lowest total costs.
Output
Returns an array of ClusterItem objects.
[
{
"id": "04fee66e-0078-4ed2-b1f1-0c234557fca3",
"metadata": {
"id": "04fee66e-0078-4ed2-b1f1-0c234557fca3",
"name": "realtheory-cluster-01",
"timestamp": "2024-03-08T00:59:11.6810368Z"
},
"totalCost": 896.82258,
"utilization": 39.64,
"clusterName": "realtheory-cluster-01",
"accountName": "RealTheory,Inc.",
"accountOwner": "Joe.Bloggs"
},
{
"id": "f99e055f-b35d-208b-63b1-f4222b80151a",
"metadata": {
"id": "f99e055f-b35d-208b-63b1-f4222b80151a",
"name": "realtheory-cluster-02",
"timestamp": "2024-03-08T00:59:44.4942969Z"
},
"totalCost": 227.59565,
"utilization": 24.06,
"clusterName": "realtheory-cluster-02",
"accountName": "RealTheory,Inc.",
"accountOwner": "Fred.Blogs"
},
...
]
Note: Content has been omitted from the JSON response above for brevity.
Was this article helpful?