Managing GPU metrics
GPU metrics define how GPU usage is recorded and exposed through the metering system for billing and reporting.
When you create or modify a GPU metric, it is saved as a draft. To make your metrics available for metering, you need to pass their configuration to Ceilometer by applying pending changes.
Limitations
- Metric names must be unique. The metric name format is
gpu.<name>, where<name>contains only letters (a-z, A-Z), numbers (0-9), dots (.), and underscores (_). For example:gpu.l40s,gpu.nvidia_232, orgpu.t4.
Prerequisites
- GPU aliases are synchronized, as described in Managing GPU aliases.
To create a GPU metric
Admin panel
Command-line interface
Use the following command:
vinfra service compute gpu-metric create --metric-name <metric-name> [--aliases <alias>] [--status <status>]
--metric-name <metric-name>- Metric name (e.g.,
gpu.t4,gpu.h200) --aliases <alias>- Comma-separated alias names to associate with this metric (e.g.,
teslaT4,nvidia-224) --status <status>- Metric status (default:
active)
For example, to create the GPU metric gpu.nvidia_319 with the alias nvidia-319, run:
# vinfra service compute gpu-metric create --metric-name gpu.nvidia_319 --aliases nvidia-319
The metric is created in the draft state. To apply the pending changes, run:
# vinfra service compute gpu-metric apply
You can check that the metric is successfully created in the vinfra service compute gpu-metric list output:
# vinfra service compute gpu-metric list +---------------+----------------+--------+-----------+--------------------------------------------+ | id | metric_name | status | state | aliases | +---------------+----------------+--------+-----------+--------------------------------------------+ | 81e31f00<...> | gpu.nvidia_319 | active | unchanged | - id: 9ce13ad6-f9e7-44c1-9d27-5106868b4bfe | | | | | | name: nvidia-319 | | | | | | nodes: | | | | | | - 78a80b1a-dd17-4637-88f8-ab0d1af4db0c | | | | | | - bcedcef0-88bd-442e-8d1d-8aa376e0aa0c | +---------------+----------------+--------+-----------+--------------------------------------------+
To edit a GPU metric
Admin panel
- On the Compute > Billing metering screen, click the required metric.
- On the metric right pane, click Edit metric.
- Change the metric name or GPU aliases and click Save. The updated metric is saved in the draft state.
- On the Billing metering screen, click Apply.
Command-line interface
Use the following command:
vinfra service compute gpu-metric update [--metric-name <metric-name>] [--aliases <alias>] <metric-id>
--metric-name <metric-name>- New metric name
--aliases <alias>- Comma-separated alias names to associate with this metric (replaces existing values; e.g.,
teslaT4,nvidia-224) <metric-id>- Metric ID
For example, to change the alias of the metric with the ID 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2 to gpu, run:
# vinfra service compute gpu-metric update --aliases gpu 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2
The updated metric is saved in the draft state. To apply the pending changes, run:
# vinfra service compute gpu-metric apply
To enable or disable a metric
Admin panel
- On the Compute > Billing metering screen, click the required metric.
- On the metric right pane, click Enable or Disable. The updated metric is saved in the draft state.
- On the Billing metering screen, click Apply.
Command-line interface
Use the following command:
vinfra service compute gpu-metric update [--status <status>] <metric-id>
--status <status>- Metric status (
activeordisabled) <metric-id>- Metric ID
For example, to diable the metric with the ID 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2, run:
# vinfra service compute gpu-metric update --status disabled
The updated metric is saved in the draft state. To apply the pending changes, run:
# vinfra service compute gpu-metric apply
To delete a GPU metric
Admin panel
- On the Compute > Billing metering screen, click the required metric.
- On the metric right pane, click Delete.
- In the confirmation window, click Confirm. The marked metric is saved in the draft state.
- On the Billing metering screen, click Apply.
Command-line interface
Use the following command:
vinfra service compute gpu-metric delete <metric-id>
<metric-id>- Metric ID
For example, to mark the metric with the ID 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2 for deletion, run:
# vinfra service compute gpu-metric delete 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2
The marked metric is saved in the draft state. To apply the pending changes, run:
# vinfra service compute gpu-metric apply
To discard pending changes
Admin panel
- On the Compute > Billing metering screen, click Discard.
- In the confirmation window, click Discard.
Command-line interface
Use the following command:
vinfra service compute gpu-metric discard <metric-id>
<metric-id>- Metric ID (if not provided, all pending changes are discarded)
For example, to discard changes to the metric with the ID 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2, run:
# vinfra service compute gpu-metric discard 81e31f00-d3f9-42a3-b4c8-4bb9a83d9df2 +----------------+-------+ | Field | Value | +----------------+-------+ | deleted_count | 0 | | reverted_count | 1 | +----------------+-------+