summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/modules/fail2ban/init.go
blob: 938c9697abbe789824e2a8df0aca5df3f2625ed1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// SPDX-License-Identifier: GPL-3.0-or-later

package fail2ban

import (
	"fmt"
	"os"
	"path/filepath"

	"github.com/netdata/netdata/go/go.d.plugin/agent/executable"
)

func (f *Fail2Ban) initFail2banClientCliExec() (fail2banClientCli, error) {
	ndsudoPath := filepath.Join(executable.Directory, "ndsudo")
	if _, err := os.Stat(ndsudoPath); err != nil {
		return nil, fmt.Errorf("ndsudo executable not found: %v", err)

	}

	f2bClientExec := newFail2BanClientCliExec(ndsudoPath, f.Timeout.Duration(), f.Logger)

	return f2bClientExec, nil
}