fix(inputs.opcua): Verify groups or root nodes included in config (#13840)

This commit is contained in:
Joshua Powers 2023-08-30 07:56:34 -06:00 committed by GitHub
parent 926c63ef60
commit 3bcf72293d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -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
}