fix(inputs.opcua): Verify groups or root nodes included in config (#13840)
This commit is contained in:
parent
926c63ef60
commit
3bcf72293d
|
|
@ -2,6 +2,7 @@ package input
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
@ -75,6 +76,15 @@ func (o *InputClientConfig) Validate() error {
|
||||||
o.TimestampFormat = time.RFC3339Nano
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue