fix(ibm.d): various fixes (#21123)
Ilya Mashchenko committed
Oct 9, 2025 at 17:32 UTC
f6ba56fb6d2392a38026cd111e005c63f6adebbd
4 files changed
+33
-16
src/go/cmd/ibmdplugin/main.go
+1
@@ -99,6 +99,7 @@ func main() {
99
DumpSummary: opts.DumpSummary,
100
DumpDataDir: dumpDataDir,
101
DynamicConfigPrefix: "ibm.d:collector:",
102
+ DisableServiceDiscovery: true,
103
})
104
105
a.Debugf("plugin: name=%s, version=%s", a.Name, buildinfo.Version)
src/go/plugin/go.d/agent/agent.go
+18
-10
@@ -30,20 +30,25 @@ var isTerminal = isatty.IsTerminal(os.Stdout.Fd())
30
31
// Config is an Agent configuration.
32
type Config struct {
33
- Name string
34
- PluginConfigDir []string
33
+ Name string
34
+ PluginConfigDir []string
35
+
36
CollectorsConfigDir []string
37
CollectorsConfigWatchPath []string
38
ServiceDiscoveryConfigDir []string
39
VarLibDir string
39
- ModuleRegistry module.Registry
40
- RunModule string
41
- RunJob []string
42
- MinUpdateEvery int
43
- DumpMode time.Duration
44
- DumpSummary bool
45
- DumpDataDir string
46
- DynamicConfigPrefix string
40
+
41
+ ModuleRegistry module.Registry
42
+ RunModule string
43
+ RunJob []string
44
+ MinUpdateEvery int
45
+
46
+ DisableServiceDiscovery bool
47
+
48
+ DumpMode time.Duration
49
+ DumpSummary bool
50
+ DumpDataDir string
51
+ DynamicConfigPrefix string
52
}
53
54
// Agent represents orchestrator.
@@ -63,6 +68,8 @@ type Agent struct {
68
RunJob []string
69
MinUpdateEvery int
70
71
+ DisableServiceDiscovery bool
72
+
73
ModuleRegistry module.Registry
74
Out io.Writer
75
@@ -108,6 +115,7 @@ func New(cfg Config) *Agent {
115
dumpMode: cfg.DumpMode,
116
dumpSummary: cfg.DumpSummary,
117
DynamicConfigPrefix: cfg.DynamicConfigPrefix,
118
+ DisableServiceDiscovery: cfg.DisableServiceDiscovery,
119
}
120
121
if a.dumpMode > 0 {
src/go/plugin/go.d/agent/jobmgr/filestatus.go
+4
-1
@@ -8,14 +8,17 @@ import (
8
"os"
9
"path/filepath"
10
"slices"
11
+ "strings"
12
"sync"
13
14
+ "github.com/netdata/netdata/go/plugins/pkg/executable"
15
"github.com/netdata/netdata/go/plugins/plugin/go.d/agent/confgroup"
16
"github.com/netdata/netdata/go/plugins/plugin/go.d/agent/filepersister"
17
)
18
19
func statusFileName(dir string) string {
18
- return filepath.Join(dir, "god-jobs-statuses.json")
20
+ name := strings.ReplaceAll(executable.Name, ".", "")
21
+ return filepath.Join(dir, fmt.Sprintf("%s-jobs-statuses.json", name))
22
}
23
24
func (m *Manager) loadFileStatus() {
src/go/plugin/go.d/agent/setup.go
+10
-5
@@ -129,19 +129,24 @@ func (a *Agent) buildDiscoveryConf(enabled module.Registry) discovery.Config {
129
130
a.Infof("dummy/read/watch paths: %d/%d/%d", len(dummyPaths), len(readPaths), len(a.CollectorsConfigWatchPath))
131
132
- return discovery.Config{
132
+ cfg := discovery.Config{
133
Registry: reg,
134
File: file.Config{
135
Read: readPaths,
136
Watch: a.CollectorsConfigWatchPath,
137
},
138
- Dummy: dummy.Config{
138
+ }
139
+
140
+ if !a.DisableServiceDiscovery {
141
+ cfg.Dummy = dummy.Config{
142
Names: dummyPaths,
140
- },
141
- SD: sd.Config{
143
+ }
144
+ cfg.SD = sd.Config{
145
ConfDir: a.ServiceDiscoveryConfigDir,
143
- },
146
+ }
147
}
148
+
149
+ return cfg
150
}
151
152
func (a *Agent) setupVnodeRegistry() map[string]*vnodes.VirtualNode {