blob: 258d1b830692720e8c664f273ddae6dfb7594fb1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// SPDX-License-Identifier: GPL-3.0-or-later
package discovery
import (
"errors"
"github.com/netdata/netdata/go/plugins/plugin/go.d/agent/confgroup"
"github.com/netdata/netdata/go/plugins/plugin/go.d/agent/discovery/dummy"
"github.com/netdata/netdata/go/plugins/plugin/go.d/agent/discovery/file"
"github.com/netdata/netdata/go/plugins/plugin/go.d/agent/discovery/sd"
)
type Config struct {
Registry confgroup.Registry
File file.Config
Dummy dummy.Config
SD sd.Config
}
func validateConfig(cfg Config) error {
if len(cfg.Registry) == 0 {
return errors.New("empty config registry")
}
if len(cfg.File.Read)+len(cfg.File.Watch) == 0 && len(cfg.Dummy.Names) == 0 {
return errors.New("discoverers not set")
}
return nil
}
|