Documentation
¶
Index ¶
- type BrowseConfig
- type BrowsePathSettings
- type DataChangeFilter
- type DeadbandType
- type EventGroupSettings
- type EventNodeMetricMapping
- type EventNodeSettings
- type InputClientConfig
- type MonitoringParameters
- type NodeGroupSettings
- type NodeMetricMapping
- type NodeSettings
- type NodeValue
- type OpcUAInputClient
- func (o *OpcUAInputClient) DiscoverNodes(ctx context.Context) error
- func (o *OpcUAInputClient) InitEventNodeIDs() error
- func (o *OpcUAInputClient) InitNodeIDs() error
- func (o *OpcUAInputClient) InitNodeMetricMapping() error
- func (o *OpcUAInputClient) MetricForEvent(nodeIdx int, event *ua.EventFieldList) telegraf.Metric
- func (o *OpcUAInputClient) MetricForNode(nodeIdx int) telegraf.Metric
- func (o *OpcUAInputClient) Stop(ctx context.Context) <-chan struct{}
- func (o *OpcUAInputClient) UpdateNodeValue(nodeIdx int, d *ua.DataValue)
- type TimestampSource
- type Trigger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BrowseConfig ¶ added in v1.39.0
type BrowseConfig struct {
Root string `toml:"root"`
Depth int `toml:"depth"`
MaxNodes int `toml:"max_nodes"`
BatchSize int `toml:"batch_size"`
Paths []BrowsePathSettings `toml:"paths"`
// contains filtered or unexported fields
}
BrowseConfig configures address-space discovery for the input client. When Paths is empty, browse-based discovery is disabled and the existing nodes/group/events configuration is used as-is.
type BrowsePathSettings ¶ added in v1.39.0
type BrowsePathSettings struct {
Pattern string `toml:"pattern"`
MetricName string `toml:"name"`
DefaultTags map[string]string `toml:"default_tags"`
// contains filtered or unexported fields
}
BrowsePathSettings is one pattern-based discovery rule.
type DataChangeFilter ¶ added in v1.29.0
type DataChangeFilter struct {
Trigger Trigger `toml:"trigger"`
DeadbandType DeadbandType `toml:"deadband_type"`
DeadbandValue *float64 `toml:"deadband_value"`
}
type DeadbandType ¶ added in v1.29.0
type DeadbandType string
const ( None DeadbandType = "None" Absolute DeadbandType = "Absolute" Percent DeadbandType = "Percent" )
type EventGroupSettings ¶ added in v1.35.0
type EventGroupSettings struct {
SamplingInterval config.Duration `toml:"sampling_interval"`
QueueSize uint32 `toml:"queue_size"`
EventTypeNode EventNodeSettings `toml:"event_type_node"`
Namespace string `toml:"namespace"`
NamespaceURI string `toml:"namespace_uri"`
IdentifierType string `toml:"identifier_type"`
NodeIDSettings []EventNodeSettings `toml:"node_ids"`
SourceNames []string `toml:"source_names"`
Fields []string `toml:"fields"`
}
func (*EventGroupSettings) UpdateNodeIDSettings ¶ added in v1.35.0
func (e *EventGroupSettings) UpdateNodeIDSettings()
func (*EventGroupSettings) Validate ¶ added in v1.35.0
func (e *EventGroupSettings) Validate() error
type EventNodeMetricMapping ¶ added in v1.35.0
type EventNodeMetricMapping struct {
NodeID *ua.NodeID
SamplingInterval *config.Duration
QueueSize *uint32
EventTypeNode *ua.NodeID
SourceNames []string
Fields []string
}
func (*EventNodeMetricMapping) CreateEventFilter ¶ added in v1.35.0
func (node *EventNodeMetricMapping) CreateEventFilter() (*ua.ExtensionObject, error)
CreateEventFilter creates a new event filter for event streaming
type EventNodeSettings ¶ added in v1.35.0
type EventNodeSettings struct {
NodeIDStr string `toml:"id"`
Namespace string `toml:"namespace"`
NamespaceURI string `toml:"namespace_uri"`
IdentifierType string `toml:"identifier_type"`
Identifier string `toml:"identifier"`
}
func (*EventNodeSettings) NodeID ¶ added in v1.35.0
func (e *EventNodeSettings) NodeID() string
type InputClientConfig ¶
type InputClientConfig struct {
opcua.OpcUAClientConfig
MetricName string `toml:"name"`
Timestamp TimestampSource `toml:"timestamp"`
TimestampFormat string `toml:"timestamp_format"`
RootNodes []NodeSettings `toml:"nodes"`
Groups []NodeGroupSettings `toml:"group"`
EventGroups []EventGroupSettings `toml:"events"`
Browse BrowseConfig `toml:"browse"`
}
InputClientConfig a configuration for the input client
func (*InputClientConfig) CreateInputClient ¶
func (o *InputClientConfig) CreateInputClient(log telegraf.Logger) (*OpcUAInputClient, error)
func (*InputClientConfig) Validate ¶
func (o *InputClientConfig) Validate() error
type MonitoringParameters ¶ added in v1.29.0
type MonitoringParameters struct {
SamplingInterval config.Duration `toml:"sampling_interval"`
QueueSize *uint32 `toml:"queue_size"`
DiscardOldest *bool `toml:"discard_oldest"`
DataChangeFilter *DataChangeFilter `toml:"data_change_filter"`
}
type NodeGroupSettings ¶
type NodeGroupSettings struct {
MetricName string `toml:"name"` // Overrides plugin's setting
Namespace string `toml:"namespace"` // Can be overridden by node setting
NamespaceURI string `toml:"namespace_uri"` // Can be overridden by node setting
IdentifierType string `toml:"identifier_type"` // Can be overridden by node setting
Nodes []NodeSettings `toml:"nodes"`
DefaultTags map[string]string `toml:"default_tags"`
SamplingInterval config.Duration `toml:"sampling_interval"` // Can be overridden by monitoring parameters
}
NodeGroupSettings describes a mapping of group of nodes to Metrics
func ResolveBrowsedNodes ¶ added in v1.39.0
func ResolveBrowsedNodes(nodes []*opcua.BrowsedNode, paths []BrowsePathSettings) ([]NodeGroupSettings, int)
ResolveBrowsedNodes converts discovered Variable nodes that match one or more browse-path patterns into NodeGroupSettings, one group per configured path with matches. Each path's compiled filter is populated in InputClientConfig.Validate with "/" as the segment separator, so patterns support *, **, ?, [abc], {a,b,c}, and \ escapes.
A node may match multiple patterns and appear in multiple groups; downstream duplicate detection enforces uniqueness on (metric_name, field_name, tags). Non-Variable nodes and nodes with an empty BrowseName are skipped. Groups with no matching nodes are omitted from the result. The second return value is the total count of node/pattern matches across all groups.
type NodeMetricMapping ¶
type NodeMetricMapping struct {
Tag NodeSettings
MetricTags map[string]string
// contains filtered or unexported fields
}
NodeMetricMapping mapping from a single node to a metric
func NewNodeMetricMapping ¶
func NewNodeMetricMapping(metricName string, node NodeSettings, groupTags map[string]string) (*NodeMetricMapping, error)
NewNodeMetricMapping builds a new NodeMetricMapping from the given argument
type NodeSettings ¶
type NodeSettings struct {
FieldName string `toml:"name"`
NodeIDStr string `toml:"id"`
Namespace string `toml:"namespace"`
NamespaceURI string `toml:"namespace_uri"`
IdentifierType string `toml:"identifier_type"`
Identifier string `toml:"identifier"`
DefaultTags map[string]string `toml:"default_tags"`
MonitoringParams MonitoringParameters `toml:"monitoring_params"`
}
NodeSettings describes how to map from a OPC UA node to a Metric
func (*NodeSettings) NodeID ¶
func (tag *NodeSettings) NodeID() string
NodeID returns the OPC UA node id
type NodeValue ¶
type NodeValue struct {
TagName string
Value interface{}
Quality ua.StatusCode
ServerTime time.Time
SourceTime time.Time
DataType ua.TypeID
IsArray bool
}
NodeValue The received value for a node
type OpcUAInputClient ¶
type OpcUAInputClient struct {
*opcua.OpcUAClient
Config InputClientConfig
Log telegraf.Logger
NodeMetricMapping []NodeMetricMapping
NodeIDs []*ua.NodeID
LastReceivedData []NodeValue
EventGroups []EventGroupSettings
EventNodeMetricMapping []EventNodeMetricMapping
// contains filtered or unexported fields
}
OpcUAInputClient can receive data from an OPC UA server and map it to Metrics. This type does not contain logic for actually retrieving data from the server, but is used by other types like ReadClient and OpcUAInputSubscribeClient to store data needed to convert node ids to the corresponding metrics.
func (*OpcUAInputClient) DiscoverNodes ¶ added in v1.39.0
func (o *OpcUAInputClient) DiscoverNodes(ctx context.Context) error
DiscoverNodes walks the address space using the configured browse settings and replaces any previously discovered node groups on the client's configuration with the freshly resolved ones. User-supplied groups (those present before any discovery) are preserved. Safe to call repeatedly across reconnects so dynamically added or removed server nodes are picked up. Browse failures bubble up as errors, but patterns that match no nodes only produce a log entry so partial-server misconfiguration does not block collection from explicit nodes.
func (*OpcUAInputClient) InitEventNodeIDs ¶ added in v1.35.0
func (o *OpcUAInputClient) InitEventNodeIDs() error
func (*OpcUAInputClient) InitNodeIDs ¶ added in v1.27.4
func (o *OpcUAInputClient) InitNodeIDs() error
func (*OpcUAInputClient) InitNodeMetricMapping ¶
func (o *OpcUAInputClient) InitNodeMetricMapping() error
InitNodeMetricMapping builds nodes from the configuration. Safe to call repeatedly: any previous mappings are discarded so the result reflects the current Config.RootNodes and Config.Groups.
func (*OpcUAInputClient) MetricForEvent ¶ added in v1.35.0
func (o *OpcUAInputClient) MetricForEvent(nodeIdx int, event *ua.EventFieldList) telegraf.Metric
func (*OpcUAInputClient) MetricForNode ¶
func (o *OpcUAInputClient) MetricForNode(nodeIdx int) telegraf.Metric
func (*OpcUAInputClient) Stop ¶
func (o *OpcUAInputClient) Stop(ctx context.Context) <-chan struct{}
Stop the connection to the client
func (*OpcUAInputClient) UpdateNodeValue ¶
func (o *OpcUAInputClient) UpdateNodeValue(nodeIdx int, d *ua.DataValue)
type TimestampSource ¶
type TimestampSource string
const ( TimestampSourceServer TimestampSource = "server" TimestampSourceSource TimestampSource = "source" TimestampSourceTelegraf TimestampSource = "gather" )