master
go 31 lines 583 Bytes
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 package exim
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 eximBinary interface {
13 countMessagesInQueue() ([]byte, error)
14 }
15
16 func newEximExec(timeout time.Duration, log *logger.Logger) *eximExec {
17 return &eximExec{
18 Logger: log,
19 timeout: timeout,
20 }
21 }
22
23 type eximExec struct {
24 *logger.Logger
25
26 timeout time.Duration
27 }
28
29 func (e *eximExec) countMessagesInQueue() ([]byte, error) {
30 return ndexec.RunNDSudo(e.Logger, e.timeout, "exim-bpc")
31 }