OPC UA 和 Cortex 集成

通过 Telegraf(InfluxData 构建的开源数据连接器)提供支持,实现强大的性能和轻松集成。

info

对于大规模实时查询,这不是推荐的配置。为了优化查询和压缩、高速摄取和高可用性,您可能需要考虑 OPC UA 和 InfluxDB

5B+

Telegraf 下载量

#1

时序数据库
来源:DB Engines

1B+

InfluxDB 下载量

2,800+

贡献者

目录

强大性能,无限扩展

收集、组织和处理海量高速数据。当您将任何数据视为时序数据时,它都更有价值。InfluxDB 是排名第一的时序平台,旨在与 Telegraf 一起扩展。

查看入门方法

输入和输出集成概述

OPC UA 插件提供了一个接口,用于从 OPC UA 服务器设备检索数据,从而促进有效的数据收集和监控。

此插件使 Telegraf 能够使用 Prometheus remote write 协议将指标发送到 Cortex,从而实现无缝摄取到 Cortex 的可扩展、多租户时序存储中。

集成详情

OPC UA

OPC UA 插件从使用 OPC UA 协议通信的设备检索数据,使您能够从 OPC UA 服务器收集和监控数据。

Cortex

通过 Telegraf 的 HTTP 输出插件和 prometheusremotewrite 数据格式,您可以将指标直接发送到 Cortex,Cortex 是 Prometheus 的水平可扩展长期存储后端。Cortex 支持多租户,并使用 Prometheus protobuf 格式接受 remote write 请求。通过使用 Telegraf 作为收集代理和 Remote Write 作为传输机制,组织可以将可观测性扩展到 Prometheus 本身不支持的来源(例如 Windows 主机、支持 SNMP 的设备或自定义应用程序指标),同时利用 Cortex 的高可用性和长保留能力。

配置

OPC UA


[[inputs.opcua]]
  ## Metric name
  # name = "opcua"
  #
  ## OPC UA Endpoint URL
  # endpoint = "opc.tcp://localhost:4840"
  #
  ## Maximum time allowed to establish a connect to the endpoint.
  # connect_timeout = "10s"
  #
  ## Maximum time allowed for a request over the established connection.
  # request_timeout = "5s"

  # Maximum time that a session shall remain open without activity.
  # session_timeout = "20m"
  #
  ## Security policy, one of "None", "Basic128Rsa15", "Basic256",
  ## "Basic256Sha256", or "auto"
  # security_policy = "auto"
  #
  ## Security mode, one of "None", "Sign", "SignAndEncrypt", or "auto"
  # security_mode = "auto"
  #
  ## Path to cert.pem. Required when security mode or policy isn't "None".
  ## If cert path is not supplied, self-signed cert and key will be generated.
  # certificate = "/etc/telegraf/cert.pem"
  #
  ## Path to private key.pem. Required when security mode or policy isn't "None".
  ## If key path is not supplied, self-signed cert and key will be generated.
  # private_key = "/etc/telegraf/key.pem"
  #
  ## Authentication Method, one of "Certificate", "UserName", or "Anonymous".  To
  ## authenticate using a specific ID, select 'Certificate' or 'UserName'
  # auth_method = "Anonymous"
  #
  ## Username. Required for auth_method = "UserName"
  # username = ""
  #
  ## Password. Required for auth_method = "UserName"
  # password = ""
  #
  ## Option to select the metric timestamp to use. Valid options are:
  ##     "gather" -- uses the time of receiving the data in telegraf
  ##     "server" -- uses the timestamp provided by the server
  ##     "source" -- uses the timestamp provided by the source
  # timestamp = "gather"
  #
  ## Client trace messages
  ## When set to true, and debug mode enabled in the agent settings, the OPCUA
  ## client's messages are included in telegraf logs. These messages are very
  ## noisey, but essential for debugging issues.
  # client_trace = false
  #
  ## Include additional Fields in each metric
  ## Available options are:
  ##   DataType -- OPC-UA Data Type (string)
  # optional_fields = []
  #
  ## Node ID configuration
  ## name              - field name to use in the output
  ## namespace         - OPC UA namespace of the node (integer value 0 thru 3)
  ## identifier_type   - OPC UA ID type (s=string, i=numeric, g=guid, b=opaque)
  ## identifier        - OPC UA ID (tag as shown in opcua browser)
  ## tags              - extra tags to be added to the output metric (optional); deprecated in 1.25.0; use default_tags
  ## default_tags      - extra tags to be added to the output metric (optional)
  ##
  ## Use either the inline notation or the bracketed notation, not both.
  #
  ## Inline notation (default_tags not supported yet)
  # nodes = [
  #   {name="", namespace="", identifier_type="", identifier="", tags=[["tag1", "value1"], ["tag2", "value2"]},
  #   {name="", namespace="", identifier_type="", identifier=""},
  # ]
  #
  ## Bracketed notation
  # [[inputs.opcua.nodes]]
  #   name = "node1"
  #   namespace = ""
  #   identifier_type = ""
  #   identifier = ""
  #   default_tags = { tag1 = "value1", tag2 = "value2" }
  #
  # [[inputs.opcua.nodes]]
  #   name = "node2"
  #   namespace = ""
  #   identifier_type = ""
  #   identifier = ""
  #
  ## Node Group
  ## Sets defaults so they aren't required in every node.
  ## Default values can be set for:
  ## * Metric name
  ## * OPC UA namespace
  ## * Identifier
  ## * Default tags
  ##
  ## Multiple node groups are allowed
  #[[inputs.opcua.group]]
  ## Group Metric name. Overrides the top level name.  If unset, the
  ## top level name is used.
  # name =
  #
  ## Group default namespace. If a node in the group doesn't set its
  ## namespace, this is used.
  # namespace =
  #
  ## Group default identifier type. If a node in the group doesn't set its
  ## namespace, this is used.
  # identifier_type =
  #
  ## Default tags that are applied to every node in this group. Can be
  ## overwritten in a node by setting a different value for the tag name.
  ##   example: default_tags = { tag1 = "value1" }
  # default_tags = {}
  #
  ## Node ID Configuration.  Array of nodes with the same settings as above.
  ## Use either the inline notation or the bracketed notation, not both.
  #
  ## Inline notation (default_tags not supported yet)
  # nodes = [
  #  {name="node1", namespace="", identifier_type="", identifier=""},
  #  {name="node2", namespace="", identifier_type="", identifier=""},
  #]
  #
  ## Bracketed notation
  # [[inputs.opcua.group.nodes]]
  #   name = "node1"
  #   namespace = ""
  #   identifier_type = ""
  #   identifier = ""
  #   default_tags = { tag1 = "override1", tag2 = "value2" }
  #
  # [[inputs.opcua.group.nodes]]
  #   name = "node2"
  #   namespace = ""
  #   identifier_type = ""
  #   identifier = ""

  ## Enable workarounds required by some devices to work correctly
  # [inputs.opcua.workarounds]
    ## Set additional valid status codes, StatusOK (0x0) is always considered valid
  # additional_valid_status_codes = ["0xC0"]

  # [inputs.opcua.request_workarounds]
    ## Use unregistered reads instead of registered reads
  # use_unregistered_reads = false

Cortex

[[outputs.http]]
  ## Cortex Remote Write endpoint
  url = "http://cortex.example.com/api/v1/push"

  ## Use POST to send data
  method = "POST"

  ## Send metrics using Prometheus remote write format
  data_format = "prometheusremotewrite"

  ## Optional HTTP headers for authentication
  # [outputs.http.headers]
  #   X-Scope-OrgID = "your-tenant-id"
  #   Authorization = "Bearer YOUR_API_TOKEN"

  ## Optional TLS configuration
  # tls_ca = "/path/to/ca.pem"
  # tls_cert = "/path/to/cert.pem"
  # tls_key = "/path/to/key.pem"
  # insecure_skip_verify = false

  ## Request timeout
  timeout = "10s"

输入和输出集成示例

OPC UA

  1. 基本配置:使用您的 OPC UA 服务器端点和所需的指标设置插件。这允许 Telegraf 开始从配置的节点收集指标。

  2. 节点 ID 设置:使用配置指定特定节点,例如温度传感器,以实时监控其值。例如,配置节点 ns=3;s=Temperature 以直接收集温度数据。

  3. 组配置:通过将多个节点分组到单个配置下,简化对多个节点的监控——这为该组中的所有节点设置默认值,从而减少设置中的冗余。

Cortex

  1. 统一的多租户监控:使用 Telegraf 从不同的团队或环境收集指标,并使用单独的 X-Scope-OrgID 标头将其推送到 Cortex。这实现了每个租户的隔离数据摄取和查询,非常适合托管服务和平台团队。

  2. 将 Prometheus 覆盖范围扩展到边缘设备:在边缘或 IoT 设备上部署 Telegraf 以收集系统指标,并将其发送到集中的 Cortex 集群。这种方法确保了即使在没有本地 Prometheus scraper 的环境中也能保持一致的可观测性。

  3. 具有联邦租户的全局服务可观测性:通过配置 Telegraf 代理将数据推送到区域 Cortex 集群(每个集群都标记有租户标识符),聚合来自全局基础设施的指标。Cortex 处理跨区域的重复数据删除和集中访问。

  4. 自定义应用程序遥测管道:通过 Telegraf 的 exechttp 输入插件收集特定于应用程序的遥测数据,并将其转发到 Cortex。这允许 DevOps 团队以可扩展、查询高效的格式监控特定于应用程序的 KPI,同时保持指标按租户或服务进行逻辑分组。

反馈

感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提供意见。请在 InfluxDB 社区 Slack 中提交您的反馈。

强大性能,无限扩展

收集、组织和处理海量高速数据。当您将任何数据视为时序数据时,它都更有价值。InfluxDB 是排名第一的时序平台,旨在与 Telegraf 一起扩展。

查看入门方法

相关集成

HTTP 和 InfluxDB 集成

HTTP 插件从一个或多个 HTTP(S) 端点收集指标。它支持各种身份验证方法和数据格式的配置选项。

查看集成

Kafka 和 InfluxDB 集成

此插件从 Kafka 读取消息,并允许根据这些消息创建指标。它支持各种配置,包括不同的 Kafka 设置和消息处理选项。

查看集成

Kinesis 和 InfluxDB 集成

Kinesis 插件允许从 AWS Kinesis 流读取指标。它支持多种输入数据格式,并提供使用 DynamoDB 的检查点功能,以实现可靠的消息处理。

查看集成