From 3bcf72293d23b9730b7f0d2559d91d6468370ed8 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Wed, 30 Aug 2023 07:56:34 -0600 Subject: [PATCH] fix(inputs.opcua): Verify groups or root nodes included in config (#13840) --- plugins/common/opcua/input/input_client.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/common/opcua/input/input_client.go b/plugins/common/opcua/input/input_client.go index 31501c6c0..29eb3c424 100644 --- a/plugins/common/opcua/input/input_client.go +++ b/plugins/common/opcua/input/input_client.go @@ -2,6 +2,7 @@ package input import ( "context" + "errors" "fmt" "sort" "strconv" @@ -75,6 +76,15 @@ func (o *InputClientConfig) Validate() error { o.TimestampFormat = time.RFC3339Nano } + if len(o.Groups) == 0 && len(o.RootNodes) == 0 { + return errors.New("no groups or root nodes provided to gather from") + } + for _, group := range o.Groups { + if len(group.Nodes) == 0 { + return errors.New("group has no nodes to collect from") + } + } + return nil }