From 93c0b0d82db4bb53c374aca87693cfcc28e5e78e Mon Sep 17 00:00:00 2001 From: Ilya Mashchenko Date: Mon, 22 Apr 2024 13:53:56 +0300 Subject: go.d windows add "vnode" to config schema (#17478) --- src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go | 8 ++++++++ .../collectors/go.d.plugin/modules/windows/config_schema.json | 10 ++++++++-- .../go.d.plugin/modules/windows/testdata/config.json | 1 + .../go.d.plugin/modules/windows/testdata/config.yaml | 1 + src/go/collectors/go.d.plugin/modules/windows/windows.go | 3 ++- 5 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go b/src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go index b747546386..37a83b7485 100644 --- a/src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go +++ b/src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go @@ -178,6 +178,14 @@ func (m *Manager) dyncfgConfigTest(fn functions.Function) { return } + if cfg.Vnode() != "" { + if _, ok := m.Vnodes.Lookup(cfg.Vnode()); !ok { + m.Warningf("dyncfg: test: module %s: vnode %s not found", mn, cfg.Vnode()) + m.dyncfgRespf(fn, 400, "The specified vnode '%s' is not registered.", cfg.Vnode()) + return + } + } + cfg.SetModule(mn) cfg.SetName("test") diff --git a/src/go/collectors/go.d.plugin/modules/windows/config_schema.json b/src/go/collectors/go.d.plugin/modules/windows/config_schema.json index 7fb5c299ee..c112abe66f 100644 --- a/src/go/collectors/go.d.plugin/modules/windows/config_schema.json +++ b/src/go/collectors/go.d.plugin/modules/windows/config_schema.json @@ -28,6 +28,11 @@ "description": "If set, the client will not follow HTTP redirects automatically.", "type": "boolean" }, + "vnode": { + "title": "Vnode", + "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.", + "type": "string" + }, "username": { "title": "Username", "description": "The username for basic authentication.", @@ -118,7 +123,8 @@ "update_every", "url", "timeout", - "not_follow_redirects" + "not_follow_redirects", + "vnode" ] }, { @@ -163,7 +169,7 @@ "ui:widget": "hidden" }, "url": { - "ui:placeholder": "http://203.0.113.0/metrics" + "ui:placeholder": "http://203.0.113.0:9182/metrics" }, "timeout": { "ui:help": "Accepts decimals for precise control (e.g., type 1.5 for 1.5 seconds)." diff --git a/src/go/collectors/go.d.plugin/modules/windows/testdata/config.json b/src/go/collectors/go.d.plugin/modules/windows/testdata/config.json index 984c3ed6e7..6f8c1084e1 100644 --- a/src/go/collectors/go.d.plugin/modules/windows/testdata/config.json +++ b/src/go/collectors/go.d.plugin/modules/windows/testdata/config.json @@ -1,5 +1,6 @@ { "update_every": 123, + "vnode": "ok", "url": "ok", "body": "ok", "method": "ok", diff --git a/src/go/collectors/go.d.plugin/modules/windows/testdata/config.yaml b/src/go/collectors/go.d.plugin/modules/windows/testdata/config.yaml index 8558b61cc0..4bbb7474d0 100644 --- a/src/go/collectors/go.d.plugin/modules/windows/testdata/config.yaml +++ b/src/go/collectors/go.d.plugin/modules/windows/testdata/config.yaml @@ -1,4 +1,5 @@ update_every: 123 +vnode: "ok" url: "ok" body: "ok" method: "ok" diff --git a/src/go/collectors/go.d.plugin/modules/windows/windows.go b/src/go/collectors/go.d.plugin/modules/windows/windows.go index a37a64dffb..cd6af9354b 100644 --- a/src/go/collectors/go.d.plugin/modules/windows/windows.go +++ b/src/go/collectors/go.d.plugin/modules/windows/windows.go @@ -69,7 +69,8 @@ func New() *Windows { type Config struct { web.HTTP `yaml:",inline" json:""` - UpdateEvery int `yaml:"update_every" json:"update_every"` + UpdateEvery int `yaml:"update_every" json:"update_every"` + Vnode string `yaml:"vnode" json:"vnode"` } type ( -- cgit v1.2.3