Skip to content

Commit 3a55e79

Browse files
committed
Add CMX usage how-to
Signed-off-by: Kyle Squizzato <[email protected]>
1 parent cad71f2 commit 3a55e79

7 files changed

+255
-0
lines changed
Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
# Compatibility Matrix Usage
2+
This topic describes using the Replicated Vendor Portal to understand
3+
Compatibility Matrix usage across your team.
4+
5+
## Currently Active Clusters and Virtual Machines
6+
You can find current active cluster and virtual machines on the Compatibility
7+
Matrix overview page which is accessible by clicking the **Compatibility Matrix**
8+
tab and then selecting **Overview** from the sidebar.
9+
10+
![Compatibility Matrix Overview Page](/images/compatibility-matrix-overview.png)
11+
12+
For more information on the Cluster and VM statuses displayed on this page
13+
see [Cluster Status](/vendor/testing-about#cluster-status).
14+
15+
## Historical Usage
16+
The Vendor Portal offers a Compatibility Matrix history page that provides
17+
historical information about both clusters and virtual machines (VMs).
18+
19+
You can access the Compatibility Matrix history page by clicking the
20+
**Compatibility Matrix** tab and then selecting **History** from the sidebar.
21+
22+
Only terminated clusters and VMs are displayed on the history page. Terminated
23+
is defined as a cluster or VM that has been deleted or errored.
24+
25+
![Compatibility Matrix History Page](/images/compatibility-matrix-history.png)
26+
27+
The top of the page displays the total number of terminated clusters and VMs
28+
in the selected time period as well as the total cost and usage time for
29+
the terminated resources.
30+
31+
The table below includes cluster and VM entries with the following columns:
32+
- **Name:** The name of the cluster or VM.
33+
- **By:** The actor that created the resource.
34+
- **Cost:** The cost of the resource, this is calculated at termination and is
35+
based on the time the resource was running.
36+
- **Distribution:** The distribution and version of the resource, for example
37+
`kind 1.32.1`.
38+
- **Type:** The distribution type of the resource. Kubernetes clusters
39+
are listed as `kubernetes` and VMs are listed as `vm`.
40+
- **Status:** The status of the resource, for example `terminated` or `error`.
41+
- **Instance:** The instance type of the resource, for example `r1.small`.
42+
- **Nodes:** The node count for "kubernetes" resources, VMs do not use this
43+
field.
44+
- **Node Groups:** The node group count for "kubernetes" resources, VMs do not
45+
use this field.
46+
- **Created At:** The time the resource was created.
47+
- **Running At:** The time the resource started running. For billing purposes,
48+
this is the time when Replicated began charging for the resource.
49+
- **Terminated At:** The time the resource was terminated. For billing
50+
purposes, this is the time when Replicated stopped charging for the resource.
51+
- **TTL:** The time-to-live for the resource, this is the maximum amount of
52+
time the resource can run before it is automatically terminated.
53+
- **Duration:** The total time the resource was running, this is the time
54+
between the `running` and `terminated` states.
55+
- **Tag:** Any tags that were applied to the resource.
56+
57+
Each of these fields can be filtered and sorted to help you find the information
58+
you are looking for. To sort by a specific field, click on the column header.
59+
The column will display an up or down arrow to denote that the column is being
60+
sorted and the direction of the sort:
61+
62+
![Compatibility Matrix History Page, column header clicked](/images/compatibility-matrix-column-sort.png)
63+
64+
To filter by a specific field, click on the filter icon in the column header:
65+
66+
![Compatibility Matrix History Page, filter icon clicked](/images/compatibility-matrix-column-filter.png)
67+
68+
Then use each specific filter input to filter the results:
69+
70+
![Compatibility Matrix History Page, filter input](/images/compatibility-matrix-column-filter-input.png)
71+
72+
73+
## Using the Vendor API v3
74+
You also use the [Vendor API v3](/vendor/vendor-api-using)
75+
to obtain Compatibility Matrix usage information.
76+
77+
To perform queries against the Vendor API v3, you must have a valid API token,
78+
see [Generating API Tokens](/vendor/replicated-api-tokens).
79+
80+
Just like the Vendor Portal, historical and running Compatibility Matrix usage
81+
is divided into distinct endpoints.
82+
83+
### Credit Balance and Summarized Usage
84+
To obtain summarized usage information in addition to your Compatibility Matrix
85+
credit balance, the `/v3/cmx/stats` endpoint can be used.
86+
87+
This endpoint returns the total number of terminated clusters and VMs, the total
88+
number of billed usage minutes, the total cost and the remaining credit balance.
89+
90+
The cost and remaining credit balance are returned in cents.
91+
92+
```shell
93+
curl --request GET \
94+
--url https://api.replicated.com/vendor/v3/customers \
95+
--header 'Accept: application/json' \
96+
--header 'Authorization: my-token'
97+
{"cluster_count":2,"vm_count":4,"usage_minutes":152,"cost":276,"credit_balance":723}%
98+
```
99+
100+
The `v3/cmx/stats` endpoint also supports filtering by `start-time` and
101+
`end-time`, for example, to get usage information for January 2025:
102+
103+
```shell
104+
curl --request GET \
105+
--url 'https://api.replicated.com/vendor/v3/cmx/stats?start-time=2025-01-01T00:00:00Z&end-time=2025-01-31T23:59:59Z' \
106+
--header 'Authorization: $REPLICATED_API_TOKEN' \
107+
--header 'accept: application/json'
108+
```
109+
110+
### Detailed Cluster and VM Usage
111+
Depending on the type of information you are looking for you can use the
112+
following endpoints to obtain active and historical CMX usage information.
113+
Each of these endpoints supports pagination and filtering. You can use the
114+
following query parameters to filter the results:
115+
116+
- **Pagination:** Use the `pageSize` and `currentPage` query parameters to
117+
paginate through the results:
118+
119+
```shell
120+
curl --request GET \
121+
--url 'https://api.replicated.com/vendor/v3/cmx/history?pageSize=10&currentPage=1' \
122+
--header 'Authorization: $REPLICATED_API_TOKEN' \
123+
--header 'accept: application/json'
124+
```
125+
126+
- **Filter by date:** Use the `start-time` and `end-time` query parameters to
127+
filter the results by a specific date range:
128+
129+
```shell
130+
curl --request GET \
131+
--url 'https://api.replicated.com/vendor/v3/cmx/history?start-time=2025-01-01T00:00:00Z&end-time=2025-01-31T23:59:59Z' \
132+
--header 'Authorization: $REPLICATED_API_TOKEN' \
133+
--header 'accept: application/json'
134+
```
135+
136+
- **Sort by:** Use the `tag-sort-key` query parameter to sort the results by a
137+
specific field. The field can be any of the fields returned in the response.
138+
- By default the results are sorted in ascending order, use
139+
`sortDesc=true` to sort in descending order:
140+
141+
```shell
142+
curl --request GET \
143+
--url 'https://api.replicated.com/vendor/v3/cmx/history?tag-sort-key=created_at&sortDesc=true' \
144+
--header 'Authorization: $REPLICATED_API_TOKEN' \
145+
--header 'accept: application/json'
146+
```
147+
148+
- **Tag filters:** Use the `tag-filter` query parameter to filter the results by
149+
a specific tag:
150+
151+
```shell
152+
curl --request GET \
153+
--url 'https://api.replicated.com/vendor/v3/cmx/history?tag-filter=tag1' \
154+
--header 'Authorization: $REPLICATED_API_TOKEN' \
155+
--header 'accept: application/json'
156+
```
157+
158+
- **Actor filters:** Use the `actor-filter` query parameter to filter the actor
159+
that created the resource, or the type of actor such as `Web UI` or
160+
`Replicated CLI`:
161+
162+
```shell
163+
curl --request GET \
164+
--url 'https://api.replicated.com/vendor/v3/cmx/history?actor-filter=name' \
165+
--header 'Authorization: $REPLICATED_API_TOKEN' \
166+
--header 'accept: application/json'
167+
```
168+
169+
170+
:::note
171+
If any filter is passed for an object that does not exist, no warning is given.
172+
For example, if you filter by `actor-filter=name` and there are no results
173+
the response will be empty.
174+
:::
175+
176+
177+
#### Currently Active Clusters
178+
To get a list of currently active clusters, the `/v3/clusters` endpoint can be
179+
used:
180+
181+
```shell
182+
curl --request GET \
183+
--url 'https://api.replicated.com/vendor/v3/clusters' \
184+
--header 'Authorization: $REPLICATED_API_TOKEN' \
185+
--header 'accept: application/json'
186+
```
187+
188+
You can use a tool such as `jq` to filter and iterate over the output:
189+
190+
```shell
191+
curl --request GET \
192+
--url 'https://api.replicated.com/vendor/v3/clusters' \
193+
--header 'Authorization: $REPLICATED_API_TOKEN' \
194+
--header 'accept: application/json' | \
195+
jq '.clusters[] | {name: .name, ttl: .ttl, distribution: .distribution, version: .version}'
196+
197+
{
198+
"name": "friendly_brown",
199+
"ttl": "1h",
200+
"distribution": "kind",
201+
"version": "1.32.1"
202+
}
203+
```
204+
205+
### Currently Active Virtual Machines
206+
Similar to clusters, to get a list of currently active virtual machines, the
207+
`/v3/vms` endpoint can be used:
208+
209+
```shell
210+
curl --request GET \
211+
--url 'https://api.replicated.com/vendor/v3/vms' \
212+
--header 'Authorization: $REPLICATED_API_TOKEN' \
213+
--header 'accept: application/json'
214+
```
215+
216+
### Historical Usage
217+
To fetch historical usage information, the `/v3/cmx/history` endpoint can be
218+
used. This endpoint returns a list of terminated clusters and VMs:
219+
220+
```shell
221+
curl --request GET \
222+
--url 'https://api.replicated.com/vendor/v3/cmx/history' \
223+
--header 'Authorization: $REPLICATED_API_TOKEN' \
224+
--header 'accept: application/json'
225+
```
226+
227+
You can specify `total-only=true` to get a quick total count of terminated
228+
clusters and VMs. The `total-only` parameter supports filtering as well:
229+
230+
```shell
231+
curl --request GET \
232+
--url 'https://api.replicated.com/vendor/v3/cmx/history?total-only=true' \
233+
--header 'Authorization: $REPLICATED_API_TOKEN' \
234+
--header 'accept: application/json'
235+
```
236+
237+
Unique to this endpoint is the ability to filter by `distribution-type` which
238+
allows you to get a list of either just clusters or just virtual machines:
239+
240+
- **For clusters use `distribution-type=kubernetes`:**
241+
```shell
242+
curl --request GET \
243+
--url 'https://api.replicated.com/vendor/v3/cmx/history?distribution-type=kubernetes' \
244+
--header 'Authorization: $REPLICATED_API_TOKEN' \
245+
--header 'accept: application/json'
246+
```
247+
248+
- **For virtual machines use `distribution-type=vm`:**
249+
```shell
250+
curl --request GET \
251+
--url 'https://api.replicated.com/vendor/v3/cmx/history?distribution-type=vm' \
252+
--header 'Authorization: $REPLICATED_API_TOKEN' \
253+
--header 'accept: application/json'
254+
```

sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ const sidebars = {
208208
'vendor/instance-notifications-config',
209209
'vendor/custom-metrics',
210210
'vendor/instance-data-export',
211+
'vendor/compatibility-matrix-usage',
211212
],
212213
},
213214
],
119 KB
Loading
3.82 KB
Loading
24 KB
Loading
575 KB
Loading
314 KB
Loading

0 commit comments

Comments
 (0)