@cryptotaxi247 / netdata-1 / commits / 83e92aa1d

chore(go.d.plugin): simplify main (#19146)

* chore(go.d.plugin): simplify main * minor

Ilya Mashchenko committed Dec 7, 2024 at 16:50 UTC 83e92aa1d1e72fbb211370c27564724e6b9b0d05
6 files changed +285 -203
src/go/cmd/godplugin/config.go new
+197
@@ -0,0 +1,197 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package main
4 +
5 +import (
6 + "errors"
7 + "io/fs"
8 + "os"
9 + "path/filepath"
10 + "strings"
11 +
12 + "github.com/netdata/netdata/go/plugins/pkg/executable"
13 + "github.com/netdata/netdata/go/plugins/pkg/multipath"
14 + "github.com/netdata/netdata/go/plugins/plugin/go.d/cli"
15 +)
16 +
17 +type envConfig struct {
18 + cygwinBase string
19 + userDir string
20 + stockDir string
21 + varLibDir string
22 + lockDir string
23 + watchPath string
24 + logLevel string
25 +}
26 +
27 +func newEnvConfig() *envConfig {
28 + cfg := &envConfig{
29 + cygwinBase: os.Getenv("NETDATA_CYGWIN_BASE_PATH"),
30 + userDir: os.Getenv("NETDATA_USER_CONFIG_DIR"),
31 + stockDir: os.Getenv("NETDATA_STOCK_CONFIG_DIR"),
32 + varLibDir: os.Getenv("NETDATA_LIB_DIR"),
33 + lockDir: os.Getenv("NETDATA_LOCK_DIR"),
34 + watchPath: os.Getenv("NETDATA_PLUGINS_GOD_WATCH_PATH"),
35 + logLevel: os.Getenv("NETDATA_LOG_LEVEL"),
36 + }
37 +
38 + cfg.userDir = cfg.handleDirOnWin(cfg.userDir)
39 + cfg.stockDir = cfg.handleDirOnWin(cfg.stockDir)
40 + cfg.varLibDir = cfg.handleDirOnWin(cfg.varLibDir)
41 + cfg.lockDir = cfg.handleDirOnWin(cfg.lockDir)
42 + cfg.watchPath = cfg.handleDirOnWin(cfg.watchPath)
43 +
44 + return cfg
45 +}
46 +
47 +func (c *envConfig) handleDirOnWin(path string) string {
48 + base := c.cygwinBase
49 +
50 + // TODO: temp workaround for debug mode
51 + if base == "" && strings.HasPrefix(executable.Directory, "C:\\msys64") {
52 + base = "C:\\msys64"
53 + }
54 +
55 + if base == "" || !strings.HasPrefix(path, "/") {
56 + return path
57 + }
58 +
59 + return filepath.Join(base, path)
60 +}
61 +
62 +type config struct {
63 + name string
64 + pluginDir multipath.MultiPath
65 + collectorsDir multipath.MultiPath
66 + collectorsWatchPath []string
67 + serviceDiscoveryDir multipath.MultiPath
68 + vnodesDir multipath.MultiPath
69 + stateFile string
70 + lockDir string
71 +}
72 +
73 +func newConfig(opts *cli.Option, env *envConfig) *config {
74 + cfg := &config{
75 + name: "go.d",
76 + }
77 +
78 + cfg.pluginDir = cfg.initPluginDir(opts, env)
79 + cfg.collectorsDir = cfg.initCollectorsDir(opts)
80 + cfg.collectorsWatchPath = cfg.initCollectorsWatchPaths(opts, env)
81 + cfg.serviceDiscoveryDir = cfg.initServiceDiscoveryConfigDir()
82 + cfg.vnodesDir = cfg.initVnodesDir()
83 + cfg.stateFile = cfg.initStateFile(env)
84 + cfg.lockDir = env.lockDir
85 +
86 + return cfg
87 +}
88 +
89 +func (c *config) initPluginDir(opts *cli.Option, env *envConfig) multipath.MultiPath {
90 + if len(opts.ConfDir) > 0 {
91 + return opts.ConfDir
92 + }
93 +
94 + if env.userDir != "" || env.stockDir != "" {
95 + return multipath.New(env.userDir, env.stockDir)
96 + }
97 +
98 + dirs := []string{
99 + filepath.Join(executable.Directory, "/../../../../etc/netdata"),
100 + }
101 +
102 + // Find the first existing standard directory
103 + standardDirs := []string{
104 + env.handleDirOnWin("/etc/netdata"),
105 + env.handleDirOnWin("/opt/netdata/etc/netdata"),
106 + }
107 + for _, dir := range standardDirs {
108 + if isDirExists(dir) {
109 + dirs = append(dirs, dir)
110 + break
111 + }
112 + }
113 +
114 + dirs = append(dirs, filepath.Join(executable.Directory, "/../../../../usr/lib/netdata/conf.d"))
115 +
116 + // Find the first existing lib directory
117 + libDirs := []string{
118 + env.handleDirOnWin("/usr/lib/netdata/conf.d"),
119 + env.handleDirOnWin("/opt/netdata/usr/lib/netdata/conf.d"),
120 + }
121 + for _, dir := range libDirs {
122 + if isDirExists(dir) {
123 + dirs = append(dirs, dir)
124 + break
125 + }
126 + }
127 +
128 + return multipath.New(dirs...)
129 +}
130 +
131 +func (c *config) initCollectorsDir(opts *cli.Option) multipath.MultiPath {
132 + if len(opts.ConfDir) > 0 {
133 + return opts.ConfDir
134 + }
135 +
136 + c.mustPluginDir()
137 +
138 + var mpath multipath.MultiPath
139 +
140 + for _, dir := range c.pluginDir {
141 + mpath = append(mpath, filepath.Join(dir, c.name))
142 + }
143 +
144 + return multipath.New(mpath...)
145 +}
146 +
147 +func (c *config) initServiceDiscoveryConfigDir() multipath.MultiPath {
148 + c.mustPluginDir()
149 +
150 + var mpath multipath.MultiPath
151 +
152 + for _, v := range c.pluginDir {
153 + mpath = append(mpath, filepath.Join(v, "sd"))
154 + }
155 +
156 + return mpath
157 +}
158 +
159 +func (c *config) initVnodesDir() multipath.MultiPath {
160 + c.mustPluginDir()
161 +
162 + var mpath multipath.MultiPath
163 +
164 + for _, v := range c.pluginDir {
165 + mpath = append(mpath, filepath.Join(v, "vnodes"))
166 + }
167 +
168 + return mpath
169 +}
170 +
171 +func (c *config) initCollectorsWatchPaths(opts *cli.Option, env *envConfig) []string {
172 + if env.watchPath == "" {
173 + return opts.WatchPath
174 + }
175 + return append(opts.WatchPath, env.watchPath)
176 +}
177 +
178 +func (c *config) initStateFile(env *envConfig) string {
179 + if env.varLibDir == "" {
180 + return ""
181 + }
182 + return filepath.Join(env.varLibDir, "god-jobs-statuses.json")
183 +}
184 +
185 +func (c *config) mustPluginDir() {
186 + if len(c.pluginDir) == 0 {
187 + panic("plugin config init: plugin dir is empty")
188 + }
189 +}
190 +
191 +func isDirExists(dir string) bool {
192 + fi, err := os.Stat(dir)
193 + if err != nil {
194 + return !errors.Is(err, fs.ErrNotExist)
195 + }
196 + return fi.Mode().IsDir()
197 +}
src/go/cmd/godplugin/main.go
+19 -138
@@ -5,17 +5,13 @@ package main
5 import (
6 "errors"
7 "fmt"
8 - "io/fs"
8 "log/slog"
9 "os"
10 "os/user"
12 - "path/filepath"
11 "strings"
12
13 "github.com/netdata/netdata/go/plugins/logger"
14 "github.com/netdata/netdata/go/plugins/pkg/buildinfo"
17 - "github.com/netdata/netdata/go/plugins/pkg/executable"
18 - "github.com/netdata/netdata/go/plugins/pkg/multipath"
15 "github.com/netdata/netdata/go/plugins/plugin/go.d/agent"
16 "github.com/netdata/netdata/go/plugins/plugin/go.d/cli"
17
@@ -26,98 +22,6 @@ import (
22 _ "github.com/netdata/netdata/go/plugins/plugin/go.d/collector"
23 )
24
29 -var (
30 - cygwinBasePath = os.Getenv("NETDATA_CYGWIN_BASE_PATH")
31 -
32 - name = "go.d"
33 - userDir = os.Getenv("NETDATA_USER_CONFIG_DIR")
34 - stockDir = os.Getenv("NETDATA_STOCK_CONFIG_DIR")
35 - varLibDir = os.Getenv("NETDATA_LIB_DIR")
36 - lockDir = os.Getenv("NETDATA_LOCK_DIR")
37 - watchPath = os.Getenv("NETDATA_PLUGINS_GOD_WATCH_PATH")
38 - envLogLevel = os.Getenv("NETDATA_LOG_LEVEL")
39 -)
40 -
41 -func init() {
42 - userDir = handleDirOnWin(userDir)
43 - stockDir = handleDirOnWin(stockDir)
44 - varLibDir = handleDirOnWin(varLibDir)
45 - lockDir = handleDirOnWin(lockDir)
46 - watchPath = handleDirOnWin(watchPath)
47 -}
48 -
49 -func confDir(opts *cli.Option) multipath.MultiPath {
50 - if len(opts.ConfDir) > 0 {
51 - return opts.ConfDir
52 - }
53 -
54 - if userDir != "" || stockDir != "" {
55 - return multipath.New(userDir, stockDir)
56 - }
57 -
58 - var dirs []string
59 -
60 - dirs = append(dirs, filepath.Join(executable.Directory, "/../../../../etc/netdata"))
61 -
62 - for _, dir := range []string{
63 - handleDirOnWin("/etc/netdata"),
64 - handleDirOnWin("/opt/netdata/etc/netdata"),
65 - } {
66 - if isDirExists(dir) {
67 - dirs = append(dirs, dir)
68 - break
69 - }
70 - }
71 -
72 - dirs = append(dirs, filepath.Join(executable.Directory, "/../../../../usr/lib/netdata/conf.d"))
73 -
74 - for _, dir := range []string{
75 - handleDirOnWin("/usr/lib/netdata/conf.d"),
76 - handleDirOnWin("/opt/netdata/usr/lib/netdata/conf.d"),
77 - } {
78 - if isDirExists(dir) {
79 - dirs = append(dirs, dir)
80 - break
81 - }
82 - }
83 -
84 - return multipath.New(dirs...)
85 -}
86 -
87 -func modulesConfDir(opts *cli.Option) (mpath multipath.MultiPath) {
88 - if len(opts.ConfDir) > 0 {
89 - return opts.ConfDir
90 - }
91 -
92 - dirs := confDir(opts)
93 - for _, dir := range dirs {
94 - mpath = append(mpath, filepath.Join(dir, name))
95 - }
96 -
97 - return multipath.New(mpath...)
98 -}
99 -
100 -func modulesConfSDDir(confDir multipath.MultiPath) (mpath multipath.MultiPath) {
101 - for _, v := range confDir {
102 - mpath = append(mpath, filepath.Join(v, "sd"))
103 - }
104 - return mpath
105 -}
106 -
107 -func watchPaths(opts *cli.Option) []string {
108 - if watchPath == "" {
109 - return opts.WatchPath
110 - }
111 - return append(opts.WatchPath, watchPath)
112 -}
113 -
114 -func stateFile() string {
115 - if varLibDir == "" {
116 - return ""
117 - }
118 - return filepath.Join(varLibDir, "god-jobs-statuses.json")
119 -}
120 -
25 func init() {
26 // https://github.com/netdata/netdata/issues/8949#issuecomment-638294959
27 if v := os.Getenv("TZ"); strings.HasPrefix(v, ":") {
@@ -135,27 +39,27 @@ func main() {
39 return
40 }
41
138 - if envLogLevel != "" {
139 - logger.Level.SetByName(envLogLevel)
140 - }
42 + env := newEnvConfig()
43 + cfg := newConfig(opts, env)
44
45 + if env.logLevel != "" {
46 + logger.Level.SetByName(env.logLevel)
47 + }
48 if opts.Debug {
49 logger.Level.Set(slog.LevelDebug)
50 }
51
146 - dir := modulesConfDir(opts)
147 -
52 a := agent.New(agent.Config{
149 - Name: name,
150 - ConfDir: confDir(opts),
151 - ModulesConfDir: dir,
152 - ModulesConfSDDir: modulesConfSDDir(dir),
153 - ModulesConfWatchPath: watchPaths(opts),
154 - VnodesConfDir: confDir(opts),
155 - StateFile: stateFile(),
156 - LockDir: lockDir,
157 - RunModule: opts.Module,
158 - MinUpdateEvery: opts.UpdateEvery,
53 + Name: cfg.name,
54 + PluginConfigDir: cfg.pluginDir,
55 + CollectorsConfigDir: cfg.collectorsDir,
56 + ServiceDiscoveryConfigDir: cfg.serviceDiscoveryDir,
57 + CollectorsConfigWatchPath: cfg.collectorsWatchPath,
58 + VnodesConfigDir: cfg.vnodesDir,
59 + StateFile: cfg.stateFile,
60 + LockDir: cfg.lockDir,
61 + RunModule: opts.Module,
62 + MinUpdateEvery: opts.UpdateEvery,
63 })
64
65 a.Debugf("plugin: name=%s, version=%s", a.Name, buildinfo.Version)
@@ -163,8 +67,8 @@ func main() {
67 a.Debugf("current user: name=%s, uid=%s", u.Username, u.Uid)
68 }
69
166 - cfg := httpproxy.FromEnvironment()
167 - a.Infof("env HTTP_PROXY '%s', HTTPS_PROXY '%s'", cfg.HTTPProxy, cfg.HTTPSProxy)
70 + proxyCfg := httpproxy.FromEnvironment()
71 + a.Infof("env HTTP_PROXY '%s', HTTPS_PROXY '%s'", proxyCfg.HTTPProxy, proxyCfg.HTTPSProxy)
72
73 a.Run()
74 }
@@ -175,32 +79,9 @@ func parseCLI() *cli.Option {
79 var flagsErr *flags.Error
80 if errors.As(err, &flagsErr) && errors.Is(flagsErr.Type, flags.ErrHelp) {
81 os.Exit(0)
178 - } else {
179 - os.Exit(1)
82 }
181 - }
182 - return opt
183 -}
184 -
185 -func isDirExists(dir string) bool {
186 - fi, err := os.Stat(dir)
187 - if err == nil {
188 - return fi.Mode().IsDir()
189 - }
190 - return !errors.Is(err, fs.ErrNotExist)
191 -}
192 -
193 -func handleDirOnWin(path string) string {
194 - base := cygwinBasePath
195 -
196 - // TODO: temp workaround for debug mode
197 - if base == "" && strings.HasPrefix(executable.Directory, "C:\\msys64") {
198 - base = "C:\\msys64"
83 + os.Exit(1)
84 }
85
201 - if base == "" || !strings.HasPrefix(path, "/") {
202 - return path
203 - }
204 -
205 - return filepath.Join(base, path)
86 + return opt
87 }
src/go/plugin/go.d/agent/agent.go
+41 -37
@@ -31,35 +31,39 @@ var isTerminal = isatty.IsTerminal(os.Stdout.Fd())
31
32 // Config is an Agent configuration.
33 type Config struct {
34 - Name string
35 - ConfDir []string
36 - ModulesConfDir []string
37 - ModulesConfSDDir []string
38 - ModulesConfWatchPath []string
39 - VnodesConfDir []string
40 - StateFile string
41 - LockDir string
42 - ModuleRegistry module.Registry
43 - RunModule string
44 - MinUpdateEvery int
34 + Name string
35 + PluginConfigDir []string
36 + CollectorsConfigDir []string
37 + CollectorsConfigWatchPath []string
38 + ServiceDiscoveryConfigDir []string
39 + VnodesConfigDir []string
40 + StateFile string
41 + LockDir string
42 + ModuleRegistry module.Registry
43 + RunModule string
44 + MinUpdateEvery int
45 }
46
47 // Agent represents orchestrator.
48 type Agent struct {
49 *logger.Logger
50
51 - Name string
52 - ConfDir multipath.MultiPath
53 - ModulesConfDir multipath.MultiPath
54 - ModulesConfSDDir multipath.MultiPath
55 - ModulesSDConfPath []string
56 - VnodesConfDir multipath.MultiPath
57 - StateFile string
58 - LockDir string
59 - RunModule string
60 - MinUpdateEvery int
61 - ModuleRegistry module.Registry
62 - Out io.Writer
51 + Name string
52 +
53 + ConfigDir multipath.MultiPath
54 + CollectorsConfDir multipath.MultiPath
55 + CollectorsConfigWatchPath []string
56 + ServiceDiscoveryConfigDir multipath.MultiPath
57 + VnodesConfigDir multipath.MultiPath
58 +
59 + StateFile string
60 + LockDir string
61 +
62 + RunModule string
63 + MinUpdateEvery int
64 +
65 + ModuleRegistry module.Registry
66 + Out io.Writer
67
68 api *netdataapi.API
69
@@ -72,20 +76,20 @@ func New(cfg Config) *Agent {
76 Logger: logger.New().With(
77 slog.String("component", "agent"),
78 ),
75 - Name: cfg.Name,
76 - ConfDir: cfg.ConfDir,
77 - ModulesConfDir: cfg.ModulesConfDir,
78 - ModulesConfSDDir: cfg.ModulesConfSDDir,
79 - ModulesSDConfPath: cfg.ModulesConfWatchPath,
80 - VnodesConfDir: cfg.VnodesConfDir,
81 - StateFile: cfg.StateFile,
82 - LockDir: cfg.LockDir,
83 - RunModule: cfg.RunModule,
84 - MinUpdateEvery: cfg.MinUpdateEvery,
85 - ModuleRegistry: module.DefaultRegistry,
86 - Out: safewriter.Stdout,
87 - api: netdataapi.New(safewriter.Stdout),
88 - quitCh: make(chan struct{}),
79 + Name: cfg.Name,
80 + ConfigDir: cfg.PluginConfigDir,
81 + CollectorsConfDir: cfg.CollectorsConfigDir,
82 + ServiceDiscoveryConfigDir: cfg.ServiceDiscoveryConfigDir,
83 + CollectorsConfigWatchPath: cfg.CollectorsConfigWatchPath,
84 + VnodesConfigDir: cfg.VnodesConfigDir,
85 + StateFile: cfg.StateFile,
86 + LockDir: cfg.LockDir,
87 + RunModule: cfg.RunModule,
88 + MinUpdateEvery: cfg.MinUpdateEvery,
89 + ModuleRegistry: module.DefaultRegistry,
90 + Out: safewriter.Stdout,
91 + api: netdataapi.New(safewriter.Stdout),
92 + quitCh: make(chan struct{}),
93 }
94 }
95
src/go/plugin/go.d/agent/setup.go
+14 -14
@@ -22,15 +22,15 @@ import (
22 func (a *Agent) loadPluginConfig() config {
23 a.Info("loading config file")
24
25 - if len(a.ConfDir) == 0 {
25 + if len(a.ConfigDir) == 0 {
26 a.Info("config dir not provided, will use defaults")
27 return defaultConfig()
28 }
29
30 cfgPath := a.Name + ".conf"
31 - a.Debugf("looking for '%s' in %v", cfgPath, a.ConfDir)
31 + a.Debugf("looking for '%s' in %v", cfgPath, a.ConfigDir)
32
33 - path, err := a.ConfDir.Find(cfgPath)
33 + path, err := a.ConfigDir.Find(cfgPath)
34 if err != nil || path == "" {
35 a.Warning("couldn't find config, will use defaults")
36 return defaultConfig()
@@ -90,7 +90,7 @@ func (a *Agent) buildDiscoveryConf(enabled module.Registry) discovery.Config {
90
91 var readPaths, dummyPaths []string
92
93 - if len(a.ModulesConfDir) == 0 {
93 + if len(a.CollectorsConfDir) == 0 {
94 if hostinfo.IsInsideK8sCluster() {
95 return discovery.Config{Registry: reg}
96 }
@@ -111,9 +111,9 @@ func (a *Agent) buildDiscoveryConf(enabled module.Registry) discovery.Config {
111 // 2nd part of this fix is in /agent/job/discovery/file/parse.go parseStaticFormat()
112 if name == "windows" {
113 cfgName := "wmi.conf"
114 - a.Debugf("looking for '%s' in %v", cfgName, a.ModulesConfDir)
114 + a.Debugf("looking for '%s' in %v", cfgName, a.CollectorsConfDir)
115
116 - path, err := a.ModulesConfDir.Find(cfgName)
116 + path, err := a.CollectorsConfDir.Find(cfgName)
117
118 if err == nil && strings.Contains(path, "etc/netdata") {
119 a.Infof("found '%s", path)
@@ -123,9 +123,9 @@ func (a *Agent) buildDiscoveryConf(enabled module.Registry) discovery.Config {
123 }
124
125 cfgName := name + ".conf"
126 - a.Debugf("looking for '%s' in %v", cfgName, a.ModulesConfDir)
126 + a.Debugf("looking for '%s' in %v", cfgName, a.CollectorsConfDir)
127
128 - path, err := a.ModulesConfDir.Find(cfgName)
128 + path, err := a.CollectorsConfDir.Find(cfgName)
129 if hostinfo.IsInsideK8sCluster() {
130 if err != nil {
131 a.Infof("not found '%s', won't use default (reading stock configs is disabled in k8s)", cfgName)
@@ -144,31 +144,31 @@ func (a *Agent) buildDiscoveryConf(enabled module.Registry) discovery.Config {
144 }
145 }
146
147 - a.Infof("dummy/read/watch paths: %d/%d/%d", len(dummyPaths), len(readPaths), len(a.ModulesSDConfPath))
147 + a.Infof("dummy/read/watch paths: %d/%d/%d", len(dummyPaths), len(readPaths), len(a.CollectorsConfigWatchPath))
148
149 return discovery.Config{
150 Registry: reg,
151 File: file.Config{
152 Read: readPaths,
153 - Watch: a.ModulesSDConfPath,
153 + Watch: a.CollectorsConfigWatchPath,
154 },
155 Dummy: dummy.Config{
156 Names: dummyPaths,
157 },
158 SD: sd.Config{
159 - ConfDir: a.ModulesConfSDDir,
159 + ConfDir: a.ServiceDiscoveryConfigDir,
160 },
161 }
162 }
163
164 func (a *Agent) setupVnodeRegistry() *vnodes.Vnodes {
165 - a.Debugf("looking for 'vnodes/' in %v", a.VnodesConfDir)
165 + a.Debugf("looking for 'vnodes/' in %v", a.VnodesConfigDir)
166
167 - if len(a.VnodesConfDir) == 0 {
167 + if len(a.VnodesConfigDir) == 0 {
168 return nil
169 }
170
171 - dirPath, err := a.VnodesConfDir.Find("vnodes/")
171 + dirPath, err := a.VnodesConfigDir.Find("vnodes/")
172 if err != nil || dirPath == "" {
173 return nil
174 }
src/go/plugin/go.d/agent/setup_test.go
+8 -8
@@ -58,8 +58,8 @@ func TestAgent_loadConfig(t *testing.T) {
58 }{
59 "valid config file": {
60 agent: Agent{
61 - Name: "agent-valid",
62 - ConfDir: []string{"testdata"},
61 + Name: "agent-valid",
62 + ConfigDir: []string{"testdata"},
63 },
64 wantCfg: config{
65 Enabled: true,
@@ -77,22 +77,22 @@ func TestAgent_loadConfig(t *testing.T) {
77 },
78 "config file not found": {
79 agent: Agent{
80 - Name: "agent",
81 - ConfDir: []string{"testdata/not-exist"},
80 + Name: "agent",
81 + ConfigDir: []string{"testdata/not-exist"},
82 },
83 wantCfg: defaultConfig(),
84 },
85 "empty config file": {
86 agent: Agent{
87 - Name: "agent-empty",
88 - ConfDir: []string{"testdata"},
87 + Name: "agent-empty",
88 + ConfigDir: []string{"testdata"},
89 },
90 wantCfg: defaultConfig(),
91 },
92 "invalid syntax config file": {
93 agent: Agent{
94 - Name: "agent-invalid-syntax",
95 - ConfDir: []string{"testdata"},
94 + Name: "agent-invalid-syntax",
95 + ConfigDir: []string{"testdata"},
96 },
97 wantCfg: defaultConfig(),
98 },
src/go/plugin/go.d/examples/simple/main.go
+6 -6
@@ -107,12 +107,12 @@ func main() {
107 )
108
109 p := agent.New(agent.Config{
110 - Name: name,
111 - ConfDir: confDir(opt.ConfDir),
112 - ModulesConfDir: modulesConfDir(opt.ConfDir),
113 - ModulesConfWatchPath: opt.WatchPath,
114 - RunModule: opt.Module,
115 - MinUpdateEvery: opt.UpdateEvery,
110 + Name: name,
111 + PluginConfigDir: confDir(opt.ConfDir),
112 + CollectorsConfigDir: modulesConfDir(opt.ConfDir),
113 + CollectorsConfigWatchPath: opt.WatchPath,
114 + RunModule: opt.Module,
115 + MinUpdateEvery: opt.UpdateEvery,
116 })
117
118 p.Run()