Skip to content

Commit

Permalink
feat(inputs.nvidia_smi): Add power-limit field for v12 scheme (#15282)
Browse files Browse the repository at this point in the history
  • Loading branch information
srebhan authored May 3, 2024
1 parent 59a7eab commit ab6133b
Show file tree
Hide file tree
Showing 4 changed files with 818 additions and 1 deletion.
51 changes: 50 additions & 1 deletion plugins/inputs/nvidia_smi/nvidia_smi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ func TestGatherValidXML(t *testing.T) {
"memory_used": 1,
"pcie_link_gen_current": 1,
"pcie_link_width_current": 8,
"power_draw": float64(4.61),
"power_draw": 4.61,
"power_limit": 75.0,
"serial": "0322218049033",
"temperature_gpu": 34,
"utilization_gpu": 0,
Expand Down Expand Up @@ -493,6 +494,54 @@ func TestGatherValidXML(t *testing.T) {
time.Unix(1689872450, 0)),
},
},
{
name: "RTC 3090 schema v12",
filename: "rtx-3090-v12.xml",
expected: []telegraf.Metric{
testutil.MustMetric(
"nvidia_smi",
map[string]string{
"compute_mode": "Default",
"index": "0",
"name": "NVIDIA GeForce RTX 3090",
"arch": "Ampere",
"pstate": "P8",
"uuid": "GPU-12345678-aaaa-bbbb-cccc-0123456789ab",
},
map[string]interface{}{
"clocks_current_graphics": 0,
"clocks_current_memory": 405,
"clocks_current_sm": 0,
"clocks_current_video": 555,
"cuda_version": "12.0",
"display_active": "Disabled",
"display_mode": "Disabled",
"driver_version": "525.147.05",
"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": 27.23,
"power_limit": 200.0,
"memory_free": 24258,
"memory_total": 24576,
"memory_used": 1,
"memory_reserved": 316,
"pcie_link_gen_current": 1,
"pcie_link_width_current": 16,
"temperature_gpu": 37,
"utilization_gpu": 0,
"utilization_memory": 0,
"utilization_encoder": 0,
"utilization_decoder": 0,
"vbios_version": "94.02.71.40.72",
},
time.Unix(1689872450, 0)),
},
},
{
name: "A100-SXM4 schema v12",
filename: "a100-sxm4-v12.xml",
Expand Down
2 changes: 2 additions & 0 deletions plugins/inputs/nvidia_smi/schema_v12/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ 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_limit", gpu.PowerReadings.PowerLimit)
common.SetIfUsed("float", fields, "power_draw", gpu.GpuPowerReadings.PowerDraw)
common.SetIfUsed("float", fields, "power_limit", gpu.GpuPowerReadings.PowerLimit)
common.SetIfUsed("float", fields, "module_power_draw", gpu.ModulePowerReadings.PowerDraw)
acc.AddFields("nvidia_smi", fields, tags, timestamp)

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/nvidia_smi/schema_v12/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ type smi struct {
MaxPowerLimit string `xml:"max_power_limit"`
MinPowerLimit string `xml:"min_power_limit"`
PowerDraw string `xml:"power_draw"`
PowerLimit string `xml:"power_limit"`
PowerState string `xml:"power_state"`
RequestedPowerLimit string `xml:"requested_power_limit"`
} `xml:"gpu_power_readings"`
Expand Down
Loading

0 comments on commit ab6133b

Please sign in to comment.