Adding upstream version 1.34.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
e393c3af3f
commit
4978089aab
4963 changed files with 677545 additions and 0 deletions
75
plugins/inputs/nvidia_smi/schema_v11/parser.go
Normal file
75
plugins/inputs/nvidia_smi/schema_v11/parser.go
Normal file
|
@ -0,0 +1,75 @@
|
|||
package schema_v11
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"strconv"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins/inputs/nvidia_smi/common"
|
||||
)
|
||||
|
||||
// Parse parses the XML-encoded data from nvidia-smi and adds measurements.
|
||||
func Parse(acc telegraf.Accumulator, buf []byte) error {
|
||||
var s smi
|
||||
if err := xml.Unmarshal(buf, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := range s.GPU {
|
||||
gpu := &s.GPU[i]
|
||||
|
||||
tags := map[string]string{
|
||||
"index": strconv.Itoa(i),
|
||||
}
|
||||
fields := make(map[string]interface{}, 39)
|
||||
|
||||
common.SetTagIfUsed(tags, "pstate", gpu.PState)
|
||||
common.SetTagIfUsed(tags, "name", gpu.ProdName)
|
||||
common.SetTagIfUsed(tags, "uuid", gpu.UUID)
|
||||
common.SetTagIfUsed(tags, "compute_mode", gpu.ComputeMode)
|
||||
|
||||
common.SetIfUsed("str", fields, "driver_version", s.DriverVersion)
|
||||
common.SetIfUsed("str", fields, "cuda_version", s.CUDAVersion)
|
||||
common.SetIfUsed("str", fields, "serial", gpu.Serial)
|
||||
common.SetIfUsed("str", fields, "vbios_version", gpu.VbiosVersion)
|
||||
common.SetIfUsed("str", fields, "display_active", gpu.DisplayActive)
|
||||
common.SetIfUsed("str", fields, "display_mode", gpu.DisplayMode)
|
||||
common.SetIfUsed("str", fields, "current_ecc", gpu.EccMode.CurrentEcc)
|
||||
common.SetIfUsed("int", fields, "fan_speed", gpu.FanSpeed)
|
||||
common.SetIfUsed("int", fields, "memory_total", gpu.Memory.Total)
|
||||
common.SetIfUsed("int", fields, "memory_used", gpu.Memory.Used)
|
||||
common.SetIfUsed("int", fields, "memory_free", gpu.Memory.Free)
|
||||
common.SetIfUsed("int", fields, "memory_reserved", gpu.Memory.Reserved)
|
||||
common.SetIfUsed("int", fields, "retired_pages_multiple_single_bit", gpu.RetiredPages.MultipleSingleBit.Count)
|
||||
common.SetIfUsed("int", fields, "retired_pages_double_bit", gpu.RetiredPages.DoubleBit.Count)
|
||||
common.SetIfUsed("str", fields, "retired_pages_blacklist", gpu.RetiredPages.PendingBlacklist)
|
||||
common.SetIfUsed("str", fields, "retired_pages_pending", gpu.RetiredPages.PendingRetirement)
|
||||
common.SetIfUsed("int", fields, "remapped_rows_correctable", gpu.RemappedRows.Correctable)
|
||||
common.SetIfUsed("int", fields, "remapped_rows_uncorrectable", gpu.RemappedRows.Uncorrectable)
|
||||
common.SetIfUsed("str", fields, "remapped_rows_pending", gpu.RemappedRows.Pending)
|
||||
common.SetIfUsed("str", fields, "remapped_rows_failure", gpu.RemappedRows.Failure)
|
||||
common.SetIfUsed("int", fields, "temperature_gpu", gpu.Temp.GPUTemp)
|
||||
common.SetIfUsed("int", fields, "utilization_gpu", gpu.Utilization.GPU)
|
||||
common.SetIfUsed("int", fields, "utilization_memory", gpu.Utilization.Memory)
|
||||
common.SetIfUsed("int", fields, "utilization_encoder", gpu.Utilization.Encoder)
|
||||
common.SetIfUsed("int", fields, "utilization_decoder", gpu.Utilization.Decoder)
|
||||
common.SetIfUsed("int", fields, "pcie_link_gen_current", gpu.PCI.LinkInfo.PCIEGen.CurrentLinkGen)
|
||||
common.SetIfUsed("int", fields, "pcie_link_width_current", gpu.PCI.LinkInfo.LinkWidth.CurrentLinkWidth)
|
||||
common.SetIfUsed("int", fields, "encoder_stats_session_count", gpu.Encoder.SessionCount)
|
||||
common.SetIfUsed("int", fields, "encoder_stats_average_fps", gpu.Encoder.AverageFPS)
|
||||
common.SetIfUsed("int", fields, "encoder_stats_average_latency", gpu.Encoder.AverageLatency)
|
||||
common.SetIfUsed("int", fields, "fbc_stats_session_count", gpu.FBC.SessionCount)
|
||||
common.SetIfUsed("int", fields, "fbc_stats_average_fps", gpu.FBC.AverageFPS)
|
||||
common.SetIfUsed("int", fields, "fbc_stats_average_latency", gpu.FBC.AverageLatency)
|
||||
common.SetIfUsed("int", fields, "clocks_current_graphics", gpu.Clocks.Graphics)
|
||||
common.SetIfUsed("int", fields, "clocks_current_sm", gpu.Clocks.SM)
|
||||
common.SetIfUsed("int", fields, "clocks_current_memory", gpu.Clocks.Memory)
|
||||
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)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
119
plugins/inputs/nvidia_smi/schema_v11/types.go
Normal file
119
plugins/inputs/nvidia_smi/schema_v11/types.go
Normal file
|
@ -0,0 +1,119 @@
|
|||
package schema_v11
|
||||
|
||||
// smi defines the structure for the output of _nvidia-smi -q -x_.
|
||||
type smi struct {
|
||||
GPU []gpu `xml:"gpu"`
|
||||
DriverVersion string `xml:"driver_version"`
|
||||
CUDAVersion string `xml:"cuda_version"`
|
||||
}
|
||||
|
||||
// gpu defines the structure of the GPU portion of the smi output.
|
||||
type gpu struct {
|
||||
Clocks clockStats `xml:"clocks"`
|
||||
ComputeMode string `xml:"compute_mode"`
|
||||
DisplayActive string `xml:"display_active"`
|
||||
DisplayMode string `xml:"display_mode"`
|
||||
EccMode eccMode `xml:"ecc_mode"`
|
||||
Encoder encoderStats `xml:"encoder_stats"`
|
||||
FanSpeed string `xml:"fan_speed"` // int
|
||||
FBC fbcStats `xml:"fbc_stats"`
|
||||
Memory memoryStats `xml:"fb_memory_usage"`
|
||||
PCI pic `xml:"pci"`
|
||||
Power powerReadings `xml:"power_readings"`
|
||||
ProdName string `xml:"product_name"`
|
||||
PState string `xml:"performance_state"`
|
||||
RemappedRows memoryRemappedRows `xml:"remapped_rows"`
|
||||
RetiredPages memoryRetiredPages `xml:"retired_pages"`
|
||||
Serial string `xml:"serial"`
|
||||
Temp tempStats `xml:"temperature"`
|
||||
Utilization utilizationStats `xml:"utilization"`
|
||||
UUID string `xml:"uuid"`
|
||||
VbiosVersion string `xml:"vbios_version"`
|
||||
}
|
||||
|
||||
// eccMode defines the structure of the ecc portions in the smi output.
|
||||
type eccMode struct {
|
||||
CurrentEcc string `xml:"current_ecc"` // Enabled, Disabled, N/A
|
||||
PendingEcc string `xml:"pending_ecc"` // Enabled, Disabled, N/A
|
||||
}
|
||||
|
||||
// memoryStats defines the structure of the memory portions in the smi output.
|
||||
type memoryStats struct {
|
||||
Total string `xml:"total"` // int
|
||||
Used string `xml:"used"` // int
|
||||
Free string `xml:"free"` // int
|
||||
Reserved string `xml:"reserved"` // int
|
||||
}
|
||||
|
||||
// memoryRetiredPages defines the structure of the retired pages portions in the smi output.
|
||||
type memoryRetiredPages struct {
|
||||
MultipleSingleBit struct {
|
||||
Count string `xml:"retired_count"` // int
|
||||
} `xml:"multiple_single_bit_retirement"`
|
||||
DoubleBit struct {
|
||||
Count string `xml:"retired_count"` // int
|
||||
} `xml:"double_bit_retirement"`
|
||||
PendingBlacklist string `xml:"pending_blacklist"` // Yes/No
|
||||
PendingRetirement string `xml:"pending_retirement"` // Yes/No
|
||||
}
|
||||
|
||||
// memoryRemappedRows defines the structure of the remapped rows portions in the smi output.
|
||||
type memoryRemappedRows struct {
|
||||
Correctable string `xml:"remapped_row_corr"` // int
|
||||
Uncorrectable string `xml:"remapped_row_unc"` // int
|
||||
Pending string `xml:"remapped_row_pending"` // Yes/No
|
||||
Failure string `xml:"remapped_row_failure"` // Yes/No
|
||||
}
|
||||
|
||||
// tempStats defines the structure of the temperature portion of the smi output.
|
||||
type tempStats struct {
|
||||
GPUTemp string `xml:"gpu_temp"` // int
|
||||
}
|
||||
|
||||
// utilizationStats defines the structure of the utilization portion of the smi output.
|
||||
type utilizationStats struct {
|
||||
GPU string `xml:"gpu_util"` // int
|
||||
Memory string `xml:"memory_util"` // int
|
||||
Encoder string `xml:"encoder_util"` // int
|
||||
Decoder string `xml:"decoder_util"` // int
|
||||
}
|
||||
|
||||
// powerReadings defines the structure of the power_readings portion of the smi output.
|
||||
type powerReadings struct {
|
||||
PowerDraw string `xml:"power_draw"` // float
|
||||
PowerLimit string `xml:"power_limit"` // float
|
||||
}
|
||||
|
||||
// pic defines the structure of the pci portion of the smi output.
|
||||
type pic struct {
|
||||
LinkInfo struct {
|
||||
PCIEGen struct {
|
||||
CurrentLinkGen string `xml:"current_link_gen"` // int
|
||||
} `xml:"pcie_gen"`
|
||||
LinkWidth struct {
|
||||
CurrentLinkWidth string `xml:"current_link_width"` // int
|
||||
} `xml:"link_widths"`
|
||||
} `xml:"pci_gpu_link_info"`
|
||||
}
|
||||
|
||||
// encoderStats defines the structure of the encoder_stats portion of the smi output.
|
||||
type encoderStats struct {
|
||||
SessionCount string `xml:"session_count"` // int
|
||||
AverageFPS string `xml:"average_fps"` // int
|
||||
AverageLatency string `xml:"average_latency"` // int
|
||||
}
|
||||
|
||||
// fbcStats defines the structure of the fbc_stats portion of the smi output.
|
||||
type fbcStats struct {
|
||||
SessionCount string `xml:"session_count"` // int
|
||||
AverageFPS string `xml:"average_fps"` // int
|
||||
AverageLatency string `xml:"average_latency"` // int
|
||||
}
|
||||
|
||||
// clockStats defines the structure of the clocks portion of the smi output.
|
||||
type clockStats struct {
|
||||
Graphics string `xml:"graphics_clock"` // int
|
||||
SM string `xml:"sm_clock"` // int
|
||||
Memory string `xml:"mem_clock"` // int
|
||||
Video string `xml:"video_clock"` // int
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue