@cryptotaxi247 / netdata-1 / commits / 93c0b0d82

go.d windows add "vnode" to config schema (#17478)

Ilya Mashchenko committed Apr 22, 2024 at 13:53 UTC 93c0b0d82db4bb53c374aca87693cfcc28e5e78e
5 files changed +20 -3
src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go
+8
@@ -178,6 +178,14 @@ func (m *Manager) dyncfgConfigTest(fn functions.Function) {
178 return
179 }
180
181 + if cfg.Vnode() != "" {
182 + if _, ok := m.Vnodes.Lookup(cfg.Vnode()); !ok {
183 + m.Warningf("dyncfg: test: module %s: vnode %s not found", mn, cfg.Vnode())
184 + m.dyncfgRespf(fn, 400, "The specified vnode '%s' is not registered.", cfg.Vnode())
185 + return
186 + }
187 + }
188 +
189 cfg.SetModule(mn)
190 cfg.SetName("test")
191
src/go/collectors/go.d.plugin/modules/windows/config_schema.json
+8 -2
@@ -28,6 +28,11 @@
28 "description": "If set, the client will not follow HTTP redirects automatically.",
29 "type": "boolean"
30 },
31 + "vnode": {
32 + "title": "Vnode",
33 + "description": "The hostname of the [virtual node](https://github.com/netdata/netdata/blob/master/docs/guides/using-host-labels.md#virtual-nodes) defined in the vnodes.conf configuration file.",
34 + "type": "string"
35 + },
36 "username": {
37 "title": "Username",
38 "description": "The username for basic authentication.",
@@ -118,7 +123,8 @@
123 "update_every",
124 "url",
125 "timeout",
121 - "not_follow_redirects"
126 + "not_follow_redirects",
127 + "vnode"
128 ]
129 },
130 {
@@ -163,7 +169,7 @@
169 "ui:widget": "hidden"
170 },
171 "url": {
166 - "ui:placeholder": "http://203.0.113.0/metrics"
172 + "ui:placeholder": "http://203.0.113.0:9182/metrics"
173 },
174 "timeout": {
175 "ui:help": "Accepts decimals for precise control (e.g., type 1.5 for 1.5 seconds)."
src/go/collectors/go.d.plugin/modules/windows/testdata/config.json
+1
@@ -1,5 +1,6 @@
1 {
2 "update_every": 123,
3 + "vnode": "ok",
4 "url": "ok",
5 "body": "ok",
6 "method": "ok",
src/go/collectors/go.d.plugin/modules/windows/testdata/config.yaml
+1
@@ -1,4 +1,5 @@
1 update_every: 123
2 +vnode: "ok"
3 url: "ok"
4 body: "ok"
5 method: "ok"
src/go/collectors/go.d.plugin/modules/windows/windows.go
+2 -1
@@ -69,7 +69,8 @@ func New() *Windows {
69
70 type Config struct {
71 web.HTTP `yaml:",inline" json:""`
72 - UpdateEvery int `yaml:"update_every" json:"update_every"`
72 + UpdateEvery int `yaml:"update_every" json:"update_every"`
73 + Vnode string `yaml:"vnode" json:"vnode"`
74 }
75
76 type (