Fix timeout parsing error in nvidia_smi (#4070)
This commit is contained in:
parent
b8d5df2076
commit
c256f17870
|
@ -36,7 +36,7 @@ var (
|
||||||
// NvidiaSMI holds the methods for this plugin
|
// NvidiaSMI holds the methods for this plugin
|
||||||
type NvidiaSMI struct {
|
type NvidiaSMI struct {
|
||||||
BinPath string
|
BinPath string
|
||||||
Timeout time.Duration
|
Timeout internal.Duration
|
||||||
|
|
||||||
metrics string
|
metrics string
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ func init() {
|
||||||
inputs.Add("nvidia_smi", func() telegraf.Input {
|
inputs.Add("nvidia_smi", func() telegraf.Input {
|
||||||
return &NvidiaSMI{
|
return &NvidiaSMI{
|
||||||
BinPath: "/usr/bin/nvidia-smi",
|
BinPath: "/usr/bin/nvidia-smi",
|
||||||
Timeout: 5 * time.Second,
|
Timeout: internal.Duration{Duration: 5 * time.Second},
|
||||||
metrics: metrics,
|
metrics: metrics,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -90,7 +90,7 @@ func init() {
|
||||||
func (smi *NvidiaSMI) pollSMI() (string, error) {
|
func (smi *NvidiaSMI) pollSMI() (string, error) {
|
||||||
// Construct and execute metrics query
|
// Construct and execute metrics query
|
||||||
opts := []string{"--format=noheader,nounits,csv", fmt.Sprintf("--query-gpu=%s", smi.metrics)}
|
opts := []string{"--format=noheader,nounits,csv", fmt.Sprintf("--query-gpu=%s", smi.metrics)}
|
||||||
ret, err := internal.CombinedOutputTimeout(exec.Command(smi.BinPath, opts...), smi.Timeout)
|
ret, err := internal.CombinedOutputTimeout(exec.Command(smi.BinPath, opts...), smi.Timeout.Duration)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue