input

package
v1.29.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 (
	Absolute DeadbandType = "Absolute"
	Percent  DeadbandType = "Percent"
)

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

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

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 added in v1.29.0

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