| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | //go:build linux || freebsd || openbsd || netbsd || dragonfly || darwin |
| 4 | |
| 5 | package nsd |
| 6 | |
| 7 | import ( |
| 8 | "time" |
| 9 | |
| 10 | "github.com/netdata/netdata/go/plugins/logger" |
| 11 | "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/ndexec" |
| 12 | ) |
| 13 | |
| 14 | type nsdControlBinary interface { |
| 15 | stats() ([]byte, error) |
| 16 | } |
| 17 | |
| 18 | func newNsdControlExec(timeout time.Duration, log *logger.Logger) *nsdControlExec { |
| 19 | return &nsdControlExec{ |
| 20 | Logger: log, |
| 21 | timeout: timeout, |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | type nsdControlExec struct { |
| 26 | *logger.Logger |
| 27 | |
| 28 | timeout time.Duration |
| 29 | } |
| 30 | |
| 31 | func (e *nsdControlExec) stats() ([]byte, error) { |
| 32 | return ndexec.RunNDSudo(e.Logger, e.timeout, "nsd-control-stats") |
| 33 | } |