master
go 33 lines 613 Bytes
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 //go:build linux
4
5 package dmcache
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 dmsetupCli interface {
15 cacheStatus() ([]byte, error)
16 }
17
18 func newDmsetupExec(timeout time.Duration, log *logger.Logger) *dmsetupExec {
19 return &dmsetupExec{
20 Logger: log,
21 timeout: timeout,
22 }
23 }
24
25 type dmsetupExec struct {
26 *logger.Logger
27
28 timeout time.Duration
29 }
30
31 func (e *dmsetupExec) cacheStatus() ([]byte, error) {
32 return ndexec.RunNDSudo(e.Logger, e.timeout, "dmsetup-status-cache")
33 }