fix: ipset crash when command not found (#10474)
This commit is contained in:
parent
c9c0516bf1
commit
d2fa0fab16
|
|
@ -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 {
|
func (i *Ipset) Gather(acc telegraf.Accumulator) error {
|
||||||
out, e := i.lister(i.Timeout, i.UseSudo)
|
out, e := i.lister(i.Timeout, i.UseSudo)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue