Opcua_listener subscription interval

Hi all,

thanks in advance for your help. Please have patience, it’s my first post. :innocent:

I try to execute some tests with Telegraf and the opcua_listener plugin.The overall plan is to collect data from an opcua server with telegraf and put it to an InfluxDB. The basic setup is working fine but I am having some troubles with the subscription interval. The node on the opcua I want to collect gets updated every 50 ms (its value is just incremented every 50 ms). However, telegraf receives a data change notification only every second. Therefore, I am loosing a lot of values. Here are some logs from telegraf:

Is it even possible to receive values in such a high frequency? If yes, what might be the reason why it is not working for me?

My actual setup is:

  • Telegraf v1.27.2 official docker image running in local k8s cluster using rancher desktop
  • Automation Studio simulation with opcua server running on local host
  • relevant parts of telegraf.conf:
      interval = "10s"
      round_interval = true
      metric_batch_size = 1000
      metric_buffer_limit = 10000
      collection_jitter = "0s"
      flush_interval = "10s"
      flush_jitter = "0s"
      precision = ""

      name = "opcua_listener"
      endpoint = "opc.tcp://host.docker.internal:4840/opcua"
      connect_timeout = "10s"
      request_timeout = "5s"
      subscription_interval = "50ms"
      timestamp = "source"
        name = "LoadTest"
        namespace = "6"
        identifier_type = "s"
        nodes = [
          {name="LoadTest", identifier="::LoadTest:LoadTest"},

Just found the issue myself. It seems that the underlying gopcua library creates the subscription with sampling interval set to 0 which lets the server fallback to its default sampling interval which was 1000 ms in my case.

Consequently, the plugin’s attribute subscription_interval only affects the publishing interval which was not clear to me.

Maybe in future it would be helpful to have an attribute for affecting sampling interval as well and not relying on a server’s standard settings? What do you think?

@reitob please open a feature-request. Furthermore, pull-requests are always welcome! :wink:

Hi @srebhan,
created a feature request → https://github.com/influxdata/telegraf/issues/13891

I will also try to contribute and open a PR for it.

1 Like