input

package
v1.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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"`
}

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 NodeGroupSettings

type NodeGroupSettings struct {
	MetricName     string            `toml:"name"`            // Overrides plugin's setting
	Namespace      string            `toml:"namespace"`       // Can be overridden by node setting
	IdentifierType string            `toml:"identifier_type"` // Can be overridden by node setting
	Nodes          []NodeSettings    `toml:"nodes"`
	TagsSlice      [][]string        `toml:"tags" deprecated:"1.26.0;use default_tags"`
	DefaultTags    map[string]string `toml:"default_tags"`
}

NodeGroupSettings describes a mapping of group of nodes to Metrics

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"`
	Namespace      string            `toml:"namespace"`
	IdentifierType string            `toml:"identifier_type"`
	Identifier     string            `toml:"identifier"`
	DataType       string            `toml:"data_type" deprecated:"1.17.0;option is ignored"`
	Description    string            `toml:"description" deprecated:"1.17.0;option is ignored"`
	TagsSlice      [][]string        `toml:"tags" deprecated:"1.25.0;use 'default_tags' instead"`
	DefaultTags    map[string]string `toml:"default_tags"`
}

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
}

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
}

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) InitNodeMetricMapping

func (o *OpcUAInputClient) InitNodeMetricMapping() error

InitNodeMetricMapping builds nodes from the configuration

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"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL