目录
输入和输出集成概述
OPC UA 插件提供了一个从 OPC UA 服务器设备检索数据的接口,从而促进有效的数据收集和监控。
此插件使用基于 HTTP 的 Prometheus 远程写入协议将指标从 Telegraf 发送到 Thanos,从而可以高效且可扩展地摄取到 Thanos Receive 组件中。
集成详情
OPC UA
OPC UA 插件从使用 OPC UA 协议通信的设备检索数据,允许您从 OPC UA 服务器收集和监控数据。
Thanos
Telegraf 的 HTTP 插件可以通过其兼容远程写入的 Receive 组件将指标直接发送到 Thanos。 通过将数据格式设置为 prometheusremotewrite,Telegraf 可以将指标序列化为本机 Prometheus 客户端使用的相同基于 protobuf 的格式。 此设置实现了高吞吐量、低延迟的指标摄取到 Thanos 中,从而促进了大规模的集中式可观测性。 它在混合环境中特别有用,在这些环境中,Telegraf 从 Prometheus 本机范围之外的系统(例如 SNMP 设备、Windows 主机或自定义应用程序)收集指标,并将它们直接流式传输到 Thanos 以进行长期存储和全局查询。
配置
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
Thanos
[[outputs.http]]
## Thanos Receive endpoint for remote write
url = "http://thanos-receive.example.com/api/v1/receive"
## HTTP method
method = "POST"
## Data format set to Prometheus remote write
data_format = "prometheusremotewrite"
## Optional headers (authorization, etc.)
# [outputs.http.headers]
# Authorization = "Bearer YOUR_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
-
基本配置:使用您的 OPC UA 服务器端点和所需的指标设置插件。 这允许 Telegraf 开始从配置的节点收集指标。
-
节点 ID 设置:使用配置来指定特定节点,例如温度传感器,以实时监控它们的值。 例如,配置节点
ns=3;s=Temperature
以直接收集温度数据。 -
组配置:通过将多个节点分组在单个配置下,简化对多个节点的监控——这为该组中的所有节点设置默认值,从而减少了设置中的冗余。
Thanos
-
无代理云监控:在云虚拟机中部署 Telegraf 代理以收集系统和应用程序指标,然后使用远程写入将它们直接流式传输到 Thanos。 这提供了集中式可观测性,而无需在每个位置都部署 Prometheus 节点。
-
可扩展的 Windows 主机监控:在 Windows 机器上使用 Telegraf 收集操作系统级指标,并通过远程写入将它们发送到 Thanos Receive。 这实现了在异构环境中的可观测性,而本机 Prometheus 仅在 Linux 上受支持。
-
跨区域指标联合:多个地理区域中的 Telegraf 代理可以使用此插件将数据推送到区域本地 Thanos Receivers。 从那里,Thanos 可以全局去重和查询指标,从而减少延迟和网络出口成本。
-
将第三方数据集成到 Thanos 中:使用 Telegraf 输入从自定义遥测源(例如 REST API 或专有日志)收集指标,并通过远程写入将它们转发到 Thanos。 这将非原生数据带入 Prometheus 兼容的长期分析管道中。
反馈
感谢您成为我们社区的一份子! 如果您有任何一般性反馈或在这些页面上发现了任何错误,我们欢迎并鼓励您提出意见。 请在 InfluxDB 社区 Slack 中提交您的反馈。