diff options
Diffstat (limited to 'src/go/plugin/go.d/modules/nvme/init.go')
-rw-r--r-- | src/go/plugin/go.d/modules/nvme/init.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/go/plugin/go.d/modules/nvme/init.go b/src/go/plugin/go.d/modules/nvme/init.go new file mode 100644 index 000000000..7196208e8 --- /dev/null +++ b/src/go/plugin/go.d/modules/nvme/init.go @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package nvme + +import ( + "fmt" + "os" + "path/filepath" + + "github.com/netdata/netdata/go/plugins/pkg/executable" +) + +func (n *NVMe) initNVMeCLIExec() (nvmeCLI, error) { + ndsudoPath := filepath.Join(executable.Directory, "ndsudo") + + if _, err := os.Stat(ndsudoPath); err != nil { + return nil, fmt.Errorf("ndsudo executable not found: %v", err) + } + + nvmeExec := &nvmeCLIExec{ + ndsudoPath: ndsudoPath, + timeout: n.Timeout.Duration(), + } + + return nvmeExec, nil +} |