| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | package samba |
| 4 | |
| 5 | import ( |
| 6 | "time" |
| 7 | |
| 8 | "github.com/netdata/netdata/go/plugins/logger" |
| 9 | "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/ndexec" |
| 10 | ) |
| 11 | |
| 12 | type smbStatusBinary interface { |
| 13 | profile() ([]byte, error) |
| 14 | } |
| 15 | |
| 16 | func newSmbStatusBinary(timeout time.Duration, log *logger.Logger) smbStatusBinary { |
| 17 | return &smbStatusExec{ |
| 18 | Logger: log, |
| 19 | timeout: timeout, |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | type smbStatusExec struct { |
| 24 | *logger.Logger |
| 25 | |
| 26 | timeout time.Duration |
| 27 | } |
| 28 | |
| 29 | func (e *smbStatusExec) profile() ([]byte, error) { |
| 30 | return ndexec.RunNDSudo(e.Logger, e.timeout, "smbstatus-profile") |
| 31 | } |