fix: ipset crash when command not found (#10474)

This commit is contained in:
Joshua Powers 2022-01-24 15:00:46 -07:00 committed by GitHub
parent c9c0516bf1
commit d2fa0fab16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -47,6 +47,15 @@ func (i *Ipset) SampleConfig() string {
`
}
func (i *Ipset) Init() error {
_, err := exec.LookPath("ipset")
if err != nil {
return err
}
return nil
}
func (i *Ipset) Gather(acc telegraf.Accumulator) error {
out, e := i.lister(i.Timeout, i.UseSudo)
if e != nil {