From d2fa0fab163b5ee5a42392676d900957d87f25a5 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Mon, 24 Jan 2022 15:00:46 -0700 Subject: [PATCH] fix: ipset crash when command not found (#10474) --- plugins/inputs/ipset/ipset.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/inputs/ipset/ipset.go b/plugins/inputs/ipset/ipset.go index 82854a35f44f3..68e7db0265374 100644 --- a/plugins/inputs/ipset/ipset.go +++ b/plugins/inputs/ipset/ipset.go @@ -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 {