input

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataChangeFilter

type DataChangeFilter struct {
	Trigger       Trigger      `toml:"trigger"`
	DeadbandType  DeadbandType `toml:"deadband_type"`
	DeadbandValue *float64     `toml:"deadband_value"`
}

type DeadbandType

type DeadbandType string
const (
	Absolute DeadbandType = "Absolute"
	Percent  DeadbandType = "Percent"
)

type EventGroupSettings

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

func (e *EventGroupSettings) UpdateNodeIDSettings()

func (*EventGroupSettings) Validate

func (e *EventGroupSettings) Validate() error

type EventNodeMetricMapping

type EventNodeMetricMapping struct {
	NodeID           *ua.NodeID
	SamplingInterval *config.Duration
	QueueSize        *uint32
	EventTypeNode    *ua.NodeID
	SourceNames      []string
	Fields           []string
}

func (*EventNodeMetricMapping) CreateEventFilter

func (node *EventNodeMetricMapping) CreateEventFilter() (*ua.ExtensionObject, error)

CreateEventFilter creates a new event filter for event streaming

type EventNodeSettings

type EventNodeSettings struct {
	Namespace      string `toml:"namespace"`
	NamespaceURI   string `toml:"namespace_uri"`
	IdentifierType string `toml:"identifier_type"`
	Identifier     string `toml:"identifier"`
}

func (*EventNodeSettings) NodeID

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

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

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

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

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

func (o *OpcUAInputClient) InitEventNodeIDs() error

func (*OpcUAInputClient) InitNodeIDs

func (o *OpcUAInputClient) InitNodeIDs() error

func (*OpcUAInputClient) InitNodeMetricMapping

func (o *OpcUAInputClient) InitNodeMetricMapping() error

InitNodeMetricMapping builds nodes from the configuration

func (*OpcUAInputClient) MetricForEvent

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

type Trigger

type Trigger string
const (
	Status               Trigger = "Status"
	StatusValue          Trigger = "StatusValue"
	StatusValueTimestamp Trigger = "StatusValueTimestamp"
)

Jump to

Keyboard shortcuts

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