fix(inputs.sysstat): Remove tmpfile to avoid file-descriptor leak (#13833)
This commit is contained in:
parent
6f38208bed
commit
c0f67db425
|
|
@ -117,6 +117,7 @@ func (s *Sysstat) Gather(acc telegraf.Accumulator) error {
|
|||
return fmt.Errorf("failed to create tmp file: %w", err)
|
||||
}
|
||||
defer os.Remove(tmpfile.Name())
|
||||
defer tmpfile.Close()
|
||||
|
||||
ts := time.Now().Add(time.Duration(s.interval) * time.Second)
|
||||
if err := s.collect(tmpfile.Name()); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue