telegraf 的 opc-ua 输入插件读取成功但不显示任何数据

问题描述 投票:0回答:2

我的计划是使用 telegraf 从 wago sps 读取 opc-ua 数据作为输入,并将数据作为输出发送到我的 influxdb 数据库。 其他插件确实可以工作,例如 mqtt 插件...所以我可以验证 influxdb 是否已正确设置。

在我的 telegraf.config 中...

# Retrieve data from OPCUA devices
[[inputs.opcua]]
  name = "opcua"
  endpoint = "opc.tcp://192.168.178.97:4840"
  connect_timeout = "10s"
  request_timeout = "5s"
  security_policy = "None"
  security_mode = "None"
  auth_method = "UserName"
  username = "admin"
  password = "wago"

  [[inputs.opcua.group]]
    namespace ="4"
    identifier_type ="s"
    nodes = [
      {name="IIoTgateway_xHeartbeat", namespace="4", identifier_type="s", identifier="|var|WAGO 750-8212 PFC200 G2 2ETH RS.Application.GVL_STATUS_PRG.IIoTgateway_xHeartbeat"},
]

使用UA Expert工具...我可以验证xHeartbeat每1秒变化一次...

telegraf 插件的日志看起来也不错......

登录数据库(influxdb)我看到变量但没有任何变化...... 这里出了什么问题? 在 telegraf 的文档中有一个声明...关于 将namespaceIndex ..number从0设置为3....这可能是问题,因为我的namespaceIndex是4?

opc-ua telegraf
2个回答
0
投票

配置文件。

[global_tags]
[agent]
  interval = "500ms"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = "0s"
  hostname = ""
  omit_hostname = false
###############################################################################
#                            OUTPUT PLUGINS                                   #
###############################################################################
[[outputs.influxdb_v2]]
  urls = ["http://${DOCKER_INFLUXDB_INIT_HOST}:${DOCKER_INFLUXDB_INIT_PORT}"]
  token = "$DOCKER_INFLUXDB_INIT_ADMIN_TOKEN"
  organization = "$DOCKER_INFLUXDB_INIT_ORG"
  bucket = "$DOCKER_INFLUXDB_INIT_BUCKET"
###############################################################################
#                            AGGREGATOR PLUGINS                               #
###############################################################################

###############################################################################
#                            INPUT PLUGINS                                    #
###############################################################################
# Retrieve data from OPCUA devices
[[inputs.opcua]]
  name = "opcua"
  endpoint = "opc.tcp://192.168.178.97:4840"
  connect_timeout = "10s"
  request_timeout = "5s"
  security_policy = "None"
  security_mode = "None"
  auth_method = "UserName"
  username = "admin"
  password = "wago"

  [[inputs.opcua.group]]
    namespace ="4"
    identifier_type ="s"
    nodes = [
      {name="IIoTgateway_xHeartbeat", namespace="4", identifier_type="s",     identifier="|var|WAGO 750-8212 PFC200 G2 2ETH RS.Application.GVL_STATUS_PRG.IIoTgateway_xHeartbeat"},
      {name="IIoTgateway_xDoorSwitch", namespace="4", identifier_type="s", identifier="|var|WAGO 750-8212 PFC200 G2 2ETH RS.Application.GVL_IIOT_BOX_INPUTS.IIoTgateway_xDoorSwitch"},
    ]

  [[outputs.file]]
  ## Files to parse each interval.  Accept standard unix glob matching rules,
  ## as well as ** to match recursive files and directories.
    files = ["./tmp/metrics.out"]
    data_format = "influx"
    rotation_interval = "24h"
    rotation_max_archives = 10

通过登录容器检查 ./tmp/metrics.out 文件后...数据正确... 确保在不断变化

from(bucket: "telegrafmqtt")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "opcua")
  |> filter(fn: (r) => r["_field"] == "IIoTgateway_xHeartbeat")
|> toInt()

toInt() 终于成功了...... 现在我看到了 1 秒心跳

最后一点...不要使用标准密码 wago 和 admin...这仅用于测试...还要确保安全的 OPC-UA 连接...


0
投票

我正在使用 telegraf OPC UA 插件连接到 Schneider OPC 服务器 (url=10.47.105.110/Schneider-Aut.OFS) 并收到错误 io 超时。请帮忙

© www.soinside.com 2019 - 2024. All rights reserved.