fix(inputs.ethtool): Check for nil (#12867)
This commit is contained in:
parent
cd9e2c6194
commit
02eea01397
|
|
@ -133,11 +133,11 @@ func (e *Ethtool) gatherEthtoolStats(iface NamespacedInterface, acc telegraf.Acc
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdget, err := e.command.Get(iface)
|
cmdget, err := e.command.Get(iface)
|
||||||
if err != nil {
|
// error text is directly from running ethtool and syscalls
|
||||||
|
if err != nil && err.Error() != "operation not supported" {
|
||||||
acc.AddError(fmt.Errorf("%q get: %w", iface.Name, err))
|
acc.AddError(fmt.Errorf("%q get: %w", iface.Name, err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range cmdget {
|
for k, v := range cmdget {
|
||||||
fields[e.normalizeKey(k)] = v
|
fields[e.normalizeKey(k)] = v
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,10 @@ func (n *NamespaceGoroutine) Get(intf NamespacedInterface) (map[string]uint64, e
|
||||||
}, nil
|
}, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
return result.(map[string]uint64), err
|
if result != nil {
|
||||||
|
return result.(map[string]uint64), err
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start locks a goroutine to an OS thread and ties it to the namespace, then
|
// Start locks a goroutine to an OS thread and ties it to the namespace, then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue