- Print
- DarkLight
How To: Get the Lost Dollars Report for Namespaces
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 Lost Dollars Report
To get the Lost Dollars report data for all namespace for a given cluster, call the method below on the K8sReports endpoint.
GET <endpoint>/theory/api/v1/k8sreports/lostdollarsreport/namespaces/search/query/{query}/{offset}/{span}?index={index}&count={count}&order={order}&direction={direction}
where
{endpoint}
- is the URL of the RealTheory SaaS portal for your account.{query}
- is a query used to limit the results to namespaces for a given cluster.{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/lostdollarsreport/namespaces/search/query/metadata.clusterName=realtheory-cluster-01/31d/31d?index=0&count=100&order=lostDollars&direction=-1
which returns the first 100 the rows for the Lost Dollars report for the last 31 days, listing only the namespaces associated with realtheory-cluster-01
cluster, sorted by namespaces with the highest lost dollars to the lowest lost dollars.
Output
Returns an array of NamespaceItem objects.
[
{
"id": "53214960-fda3-4089-9e12-a7f476317352",
"metadata": {
"id": "53214960-fda3-4089-9e12-a7f476317352",
"name": "realtheory-example",
"clusterId": "04fee66e-0078-4ed2-b1f1-0c234557fca3",
"clusterName": "realtheory-cluster-01",
"timestamp": "2024-03-08T00:59:11.6810368Z"
},
"lostDollars": 328.03961661,
"lostDollarsPercentage": 76.46,
"allocatedDollars": 429.04954461,
"utilization": 42.6,
"clusterName": "realtheory-cluster-01",
"namespaceName": "realtheory-example",
"accountName": "RealTheory,Inc.",
"accountOwner": "Joe.Bloggs"
},
{
"id": "fbd7035e-0d5e-41c1-9a72-6a841dc5053a",
"metadata": {
"id": "fbd7035e-0d5e-41c1-9a72-6a841dc5053a",
"name": "kube-system",
"clusterId": "04fee66e-0078-4ed2-b1f1-0c234557fca3",
"clusterName": "realtheory-cluster-01",
"timestamp": "2024-03-08T00:59:44.4942969Z"
},
"lostDollars": 68.17212907,
"lostDollarsPercentage": 87.83,
"allocatedDollars": 77.61569903,
"utilization": 53.3,
"clusterName": "realtheory-cluster-01",
"namespaceName": "kube-system",
"accountName": "RealTheory,Inc.",
"accountOwner": "Joe.Bloggs"
},
...
]
Note: Content has been omitted from the JSON response above for brevity.