Collecting same event multiple times with OPC-UA Listener Plugin

Hello!

I am using the opcua_listener plugin from telegraf to get production information from an industrial machine and store it in a SQL database.

Nevertheless, it is not working as I expected since the current register gets collected multiple times even if none of its fields change their status.

Here is an example of what is happening:

As you can see, the 12 pieces produced on the 10/06 at 20h46 got collected multiple times, even if when the timestamp and the monitored fields did not change their values. Note that the database_timestamp is the timestamp assigned by telegraf at the time of the reading.

Here is a view of my opcua_listener telegraf plugin configuration. I have omitted critical information, but the structure is still the same.

[[inputs.opcua_listener]]
  ## Metric name
  name = "opcua_listener"
  endpoint = "*"
  connect_timeout = "10s"
  request_timeout = "5s"
  security_policy = "*"
  security_mode = "*"
  certificate = "*"
  private_key = "*"
  auth_method = "*"
  username = "*"
  password = "*"

  ## Option to select the metric timestamp to use.
  timestamp = "server"

  # strip unneded tags
  tagexclude = ["id", "host"]
  fielddrop = ["Quality"]


  [[inputs.opcua_listener.group]]
  ## Group Metric name.
  name = "production"
  namespace = "2"
  identifier_type = "s"
  default_tags = { Maquina = "M1"}
  ## Node ID Configuration.
  nodes = [
      {name="Pieces", identifier="*"},
      {name="Weight", identifier="*"},
  ] 

Any help would be highly appreciated.

Regards,

Juan

Hi,

The OPCUA listener, listens for data and will only collect when one of the triggers is hit. In your case, it appears you have omitted any specific trigger setting so “Status” would get used. Meaning data will get read in if the status changes.

I’m not an OPCUA expert, but you are also dropping the Quality field, is it possible that, that field changes and that is why the data is collected again?

Hi jpowers!

Could you please help me to change the trigger setting from “Status” to “Value” as your proposal?

This is my current configuration about the tag:

[[inputs.opcua_listener]]
   name = "opcualistener"
   endpoint = "opc.tcp://www.xxx.yyy.zzz:aaaaa"
   connect_timeout = "10s"
   request_timeout = "5s"
   security_policy = "None"
   security_mode = "None"
  auth_method = "UserName"
  username = "******"
  password = "****"

  ## Inline notation (default_tags not supported yet)
 nodes = [
    {name="tagTEST", namespace="2", identifier_type="s", identifier="kepserverex_tagTEST"},
   ]

But as far as I understood the inline notation doesn’t allow the configuration of the trigger, I tried as follows but the telegraf debug show an error when I try to start it:

[[inputs.opcua_listener]]
   name = "opcualistener"
   endpoint = "opc.tcp://www.xxx.yyy.zzz:aaaaa"
   connect_timeout = "10s"
   request_timeout = "5s"
   security_policy = "None"
   security_mode = "None"
  auth_method = "UserName"
  username = "******"
  password = "****"


  ## data_change_filter - defines the condition under which a notification should
  ##                      be reported
  ##
  ## Data change filter
  ## trigger        - specify the conditions under which a data change notification
  ##                  should be reported, possible values:
  ##                  "Status": only report notifications if the status changes
  ##                            (default if parameter is omitted)
  ##                  "StatusValue": report notifications if either status or value
  ##                                 changes
  ##                  "StatusValueTimestamp": report notifications if either status,
  ##                                          value or timestamp changes
  ## deadband_type  - type of the deadband filter to be applied, possible values:
  ##                  "Absolute": absolute change in a data value to report a notification
  ##                  "Percent": works only with nodes that have an EURange property set
  ##                             and is defined as: send notification if
  ##                             (last value - current value) >
  ##                             (deadband_value/100.0) * ((high–low) of EURange)
  ## deadband_value - value to deadband_type, must be a float value, no filter is set
  ##                  for negative values
  ##
  ## Bracketed notation
 [[inputs.opcua_listener.nodes]]
   name = "tagTEST"
   namespace = "2"
   identifier_type = "s"
   identifier = "kepserverex_tagTEST"
   [inputs.opcua_listener.nodes.monitoring_params]
     sampling_interval = "0s"
     queue_size = 10
     discard_oldest = true

     [inputs.opcua_listener.nodes.monitoring_params.data_change_filter]
       trigger = "StatusValue"
       deadband_type = "Absolute"
       deadband_value = 0.0

This is the error message

2024-06-24T07:09:07Z E! [telegraf] Error running agent: starting input inputs.opcua_listener: creating monitored item failed with status code: A monitoring filter cannot be used in combination with the attribute specified. StatusBadFilterNotAllowed (0x80450000)

I think that the error is due to the fact that the value is a string but I didn’t find the way to omit the “deadband_type” & “deadband_value” in the config file.

I am very grateful for your help! Best Regards,