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