Skip to content

Commit

Permalink
fix(inputs.nvidia): Include power limit field for v11 (#15144)
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj committed Apr 16, 2024
1 parent 0e5d4d8 commit e313372
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions plugins/inputs/nvidia_smi/nvidia_smi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func TestGatherValidXML(t *testing.T) {
"pcie_link_gen_current": 1,
"pcie_link_width_current": 16,
"power_draw": 8.93,
"power_limit": 130.0,
"temperature_gpu": 40,
"utilization_gpu": 0,
"utilization_memory": 1,
Expand Down Expand Up @@ -265,6 +266,7 @@ func TestGatherValidXML(t *testing.T) {
"fbc_stats_average_latency": 0,
"fbc_stats_session_count": 0,
"power_draw": 26.78,
"power_limit": 70.0,
"memory_free": 13939,
"memory_total": 15360,
"memory_used": 1032,
Expand Down Expand Up @@ -317,6 +319,7 @@ func TestGatherValidXML(t *testing.T) {
"fbc_stats_session_count": 0,
"fan_speed": 0,
"power_draw": 25.58,
"power_limit": 300.0,
"memory_free": 22569,
"memory_total": 23028,
"memory_used": 22,
Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/nvidia_smi/schema_v11/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func Parse(acc telegraf.Accumulator, buf []byte) error {
common.SetIfUsed("int", fields, "clocks_current_video", gpu.Clocks.Video)

common.SetIfUsed("float", fields, "power_draw", gpu.Power.PowerDraw)
common.SetIfUsed("float", fields, "power_limit", gpu.Power.PowerLimit)
acc.AddFields("nvidia_smi", fields, tags)
}

Expand Down
3 changes: 2 additions & 1 deletion plugins/inputs/nvidia_smi/schema_v11/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ type UtilizationStats struct {

// PowerReadings defines the structure of the power_readings portion of the smi output.
type PowerReadings struct {
PowerDraw string `xml:"power_draw"` // float
PowerDraw string `xml:"power_draw"` // float
PowerLimit string `xml:"power_limit"` // float
}

// PCI defines the structure of the pci portion of the smi output.
Expand Down

0 comments on commit e313372

Please sign in to comment.