fix(inputs.nvidia): Include power limit field for v11 (#15144)

This commit is contained in:
Joshua Powers 2024-04-16 13:24:03 -06:00 committed by GitHub
parent 0e5d4d8ac8
commit e313372c51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 1 deletions

View File

@ -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,
@ -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,
@ -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,

View File

@ -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)
}

View File

@ -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.