opc-ua input plugin for telegraf is read successful but does not show any data

Viewed 107

My plan is to use telegraf to read opc-ua data from a wago sps as an input and send the data as output to my influxdb database. Other plugins do work such as the mqtt plugin...so i can verify that the influxdb is correctly set up.

in the my 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"},
]

Using the tool UA Expert...i can verify that the xHeartbeat changes every 1s... UA Expert variable read-out description

logs of telegraf plugin looks also good .... log terminal telegraf

logging into the database (influxdb) i see the variable but not any change... What is wrong here ? In the docs of telegraf there is a statement ...about set the namespaceIndex ..number from 0 to 3....could this be the problem since my namespaceIndex is 4 ?

1 Answers

the config file.

[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

after checking the ./tmp/metrics.out file by logging into the container...data comes in correct... make sure that in the flux

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() did finally the trick... now i see the 1second heardbeat

enter image description here

last not least...do not use the standart password wago and admin...this is only for testing...also ensure to secure OPC-UA connection...

Related