From 65d09d89fa951e1855f8bdb285a7a8389abc84c1 Mon Sep 17 00:00:00 2001 From: Sven Rebhan <36194019+srebhan@users.noreply.github.com> Date: Wed, 5 Mar 2025 16:23:40 +0100 Subject: [PATCH] feat(inputs.nvidia_smi): Add new power-draw fields for v12 scheme (#16579) --- plugins/inputs/nvidia_smi/nvidia_smi_test.go | 50 +++ .../inputs/nvidia_smi/schema_v12/parser.go | 3 + plugins/inputs/nvidia_smi/schema_v12/types.go | 6 + .../nvidia_smi/testdata/rtx-3060-v12.xml | 319 ++++++++++++++++++ 4 files changed, 378 insertions(+) create mode 100644 plugins/inputs/nvidia_smi/testdata/rtx-3060-v12.xml diff --git a/plugins/inputs/nvidia_smi/nvidia_smi_test.go b/plugins/inputs/nvidia_smi/nvidia_smi_test.go index 94510c3e7..1260bc347 100644 --- a/plugins/inputs/nvidia_smi/nvidia_smi_test.go +++ b/plugins/inputs/nvidia_smi/nvidia_smi_test.go @@ -426,6 +426,56 @@ func TestGatherValidXML(t *testing.T) { time.Unix(0, 0)), }, }, + { + name: "RTC 3060 schema v12", + filename: "rtx-3060-v12.xml", + expected: []telegraf.Metric{ + testutil.MustMetric( + "nvidia_smi", + map[string]string{ + "compute_mode": "Default", + "index": "0", + "name": "NVIDIA GeForce RTX 3060", + "arch": "Ampere", + "pstate": "P8", + "uuid": "GPU-d6889ff6-2523-9142-ca3c-1ca3f396a625", + }, + map[string]interface{}{ + "clocks_current_graphics": 210, + "clocks_current_memory": 405, + "clocks_current_sm": 210, + "clocks_current_video": 555, + "cuda_version": "12.8", + "display_active": "Disabled", + "display_mode": "Disabled", + "driver_version": "570.124.04", + "encoder_stats_average_fps": 0, + "encoder_stats_average_latency": 0, + "encoder_stats_session_count": 0, + "fbc_stats_average_fps": 0, + "fbc_stats_average_latency": 0, + "fbc_stats_session_count": 0, + "fan_speed": 0, + "power_draw": 11.63, + "memory_free": 11806, + "memory_total": 12288, + "memory_used": 116, + "memory_reserved": 368, + "pcie_link_gen_current": 1, + "pcie_link_width_current": 16, + "temperature_gpu": 42, + "utilization_gpu": 0, + "utilization_jpeg": 0, + "utilization_memory": 0, + "utilization_encoder": 0, + "utilization_decoder": 0, + "utilization_ofa": 0, + "vbios_version": "94.04.71.00.69", + }, + time.Unix(1689872450, 0), + ), + }, + }, { name: "RTC 3080 schema v12", filename: "rtx-3080-v12.xml", diff --git a/plugins/inputs/nvidia_smi/schema_v12/parser.go b/plugins/inputs/nvidia_smi/schema_v12/parser.go index bafd88401..dbf8745ba 100644 --- a/plugins/inputs/nvidia_smi/schema_v12/parser.go +++ b/plugins/inputs/nvidia_smi/schema_v12/parser.go @@ -77,10 +77,13 @@ func Parse(acc telegraf.Accumulator, buf []byte) error { common.SetIfUsed("int", fields, "clocks_current_memory", gpu.Clocks.MemClock) common.SetIfUsed("int", fields, "clocks_current_video", gpu.Clocks.VideoClock) common.SetIfUsed("float", fields, "power_draw", gpu.PowerReadings.PowerDraw) + common.SetIfUsed("float", fields, "power_draw", gpu.PowerReadings.InstantPowerDraw) common.SetIfUsed("float", fields, "power_limit", gpu.PowerReadings.PowerLimit) common.SetIfUsed("float", fields, "power_draw", gpu.GpuPowerReadings.PowerDraw) + common.SetIfUsed("float", fields, "power_draw", gpu.GpuPowerReadings.InstantPowerDraw) common.SetIfUsed("float", fields, "power_limit", gpu.GpuPowerReadings.PowerLimit) common.SetIfUsed("float", fields, "module_power_draw", gpu.ModulePowerReadings.PowerDraw) + common.SetIfUsed("float", fields, "module_power_draw", gpu.ModulePowerReadings.InstantPowerDraw) acc.AddFields("nvidia_smi", fields, tags, timestamp) for _, device := range gpu.MigDevices.MigDevice { diff --git a/plugins/inputs/nvidia_smi/schema_v12/types.go b/plugins/inputs/nvidia_smi/schema_v12/types.go index a65c7c8a1..40c666fc0 100644 --- a/plugins/inputs/nvidia_smi/schema_v12/types.go +++ b/plugins/inputs/nvidia_smi/schema_v12/types.go @@ -114,6 +114,8 @@ type smi struct { MaxPowerLimit string `xml:"max_power_limit"` MinPowerLimit string `xml:"min_power_limit"` PowerDraw string `xml:"power_draw"` + AveragePowerDraw string `xml:"average_power_draw"` + InstantPowerDraw string `xml:"instant_power_draw"` PowerLimit string `xml:"power_limit"` PowerState string `xml:"power_state"` RequestedPowerLimit string `xml:"requested_power_limit"` @@ -180,6 +182,8 @@ type smi struct { MaxPowerLimit string `xml:"max_power_limit"` MinPowerLimit string `xml:"min_power_limit"` PowerDraw string `xml:"power_draw"` + AveragePowerDraw string `xml:"average_power_draw"` + InstantPowerDraw string `xml:"instant_power_draw"` PowerState string `xml:"power_state"` RequestedPowerLimit string `xml:"requested_power_limit"` } `xml:"module_power_readings"` @@ -221,6 +225,8 @@ type smi struct { PowerState string `xml:"power_state"` PowerManagement string `xml:"power_management"` PowerDraw string `xml:"power_draw"` + AveragePowerDraw string `xml:"average_power_draw"` + InstantPowerDraw string `xml:"instant_power_draw"` PowerLimit string `xml:"power_limit"` DefaultPowerLimit string `xml:"default_power_limit"` EnforcedPowerLimit string `xml:"enforced_power_limit"` diff --git a/plugins/inputs/nvidia_smi/testdata/rtx-3060-v12.xml b/plugins/inputs/nvidia_smi/testdata/rtx-3060-v12.xml new file mode 100644 index 000000000..fe442f419 --- /dev/null +++ b/plugins/inputs/nvidia_smi/testdata/rtx-3060-v12.xml @@ -0,0 +1,319 @@ + + + + Sun Mar 2 15:02:02 2025 + 570.124.04 + 12.8 + 1 + + NVIDIA GeForce RTX 3060 + GeForce + Ampere + Disabled + Disabled + Enabled + None + + N/A + N/A + + + None + + Disabled + 4000 + + N/A + N/A + + N/A + GPU-d6889ff6-2523-9142-ca3c-1ca3f396a625 + 0 + 94.04.71.00.69 + No + 0x2d00 + N/A + 2487-150-A1 + N/A + + N/A + N/A + N/A + N/A + N/A + 1 + N/A + + + G001.0000.03.03 + 2.0 + N/A + N/A + + + N/A + N/A + + + N/A + N/A + + N/A + + None + N/A + N/A + + + Requested functionality has been deprecated + Requested functionality has been deprecated + + None + 570.124.04 + + N/A + + + 2D + 00 + 0000 + 3 + 0 + 248710DE + 00000000:2D:00.0 + 36583842 + + + 4 + 1 + 1 + 4 + 4 + + + 16x + 16x + + + + N/A + N/A + + 0 + 0 + 550 KB/s + 500 KB/s + N/A + N/A + + 0 % + P8 + + Active + Not Active + Not Active + Not Active + Not Active + Not Active + Not Active + Not Active + Not Active + + N/A + + 12288 MiB + 368 MiB + 116 MiB + 11806 MiB + + + 256 MiB + 5 MiB + 251 MiB + + + 0 MiB + 0 MiB + 0 MiB + + Default + + 0 % + 0 % + 0 % + 0 % + 0 % + 0 % + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + N/A + N/A + + + N/A + N/A + + + + N/A + N/A + N/A + N/A + N/A + + + N/A + N/A + N/A + N/A + N/A + N/A + + + N/A + N/A + N/A + N/A + N/A + + + + + N/A + N/A + + + N/A + N/A + + N/A + N/A + + N/A + + 42 C + N/A + 98 C + 95 C + 93 C + 83 C + N/A + N/A + + + 65 C + 90 C + + + P8 + 11.60 W + 11.63 W + 170.00 W + 170.00 W + 170.00 W + 100.00 W + 190.00 W + + + N/A + N/A + + + P8 + N/A + N/A + N/A + N/A + N/A + N/A + N/A + + N/A + + N/A + N/A + + + 210 MHz + 210 MHz + 405 MHz + 555 MHz + + + N/A + N/A + + + N/A + N/A + + + N/A + + + 2145 MHz + 2145 MHz + 7501 MHz + 1995 MHz + + + N/A + + + N/A + N/A + + + N/A + + + N/A + N/A + N/A + N/A + + N/A + N/A + N/A + N/A + + + + + 7501 MHz + 2145 MHz + + + + 7301 MHz + 2145 MHz + + + 5001 MHz + 2145 MHz + + + 810 MHz + 2100 MHz + + + + + + + + disabled + + + + \ No newline at end of file