master
go 28 lines 522 Bytes
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 //go:build linux
4
5 package systemdunits
6
7 import (
8 "errors"
9 "strings"
10
11 "github.com/netdata/netdata/go/plugins/pkg/matcher"
12 )
13
14 func (c *Collector) validateConfig() error {
15 if len(c.Include) == 0 {
16 return errors.New("'include' option not set")
17 }
18 return nil
19 }
20
21 func (c *Collector) initUnitSelector() (matcher.Matcher, error) {
22 if len(c.Include) == 0 {
23 return matcher.TRUE(), nil
24 }
25
26 expr := strings.Join(c.Include, " ")
27 return matcher.NewSimplePatternsMatcher(expr)
28 }