Telegraf (OPC UA) data incoming with 1ms speed - but InfluxDB only showing 10 sec intervals

The data is incoming with a 1 ms interval to an OPC UA server.
The data is collected via Telegraf.conf and sent to InfluxDB2.

But in InfluxDB only data every 10 sec is shown?
How do I get values every 1 ms in my Dashboard?

I don’t think the idea is to set the interval=1ms in telegraf.conf ?? This is not really working properly…

Telegraf conf: (only agent data):

[agent]

interval = “10s”

round_interval = true

metric_batch_size = 1000

metric_buffer_limit = 1000

collection_jitter = “0s”

flush_interval = “10s”

flush_jitter = “0s”

precision = “ns”

debug = false

quiet = false

#hostname = “”

T

Hi,

The two relevant config options for sending and collecting data are interval and flush_interval:

  • The interval determines how often telegraf will collect data. In this case, every 10 seconds, your telegraf will collect from your inputs.
  • The flush_interval is how often telegraf will send collected data to your output: InfluxDB.

In your scenario, to get more data, you will want to set the interval option to a smaller value (e.g., “1s”) to obtain more data. If collecting the data from your input takes too long, Telegraf will produce some errors about taking too long to collect data.

You will want to play with this setting and find a good value that consistently collects data at the right level of detail for your situation.

Thanks!

Thanks for your reply!
Ok but even with an inverval of 1-10 sec (whatever) the data should be available in 1 ms steps
(but of course send only every 10 sec as a package) ?
Only if the collecting takes too long. There could be missing data.
Because with an MQTT Broker and an interval of 10 sec it’s working that data is available every 1 ms.

Configuration for telegraf agent

[agent]

interval = “5ms”

round_interval = true

metric_batch_size = 1000

metric_buffer_limit = 1000

collection_jitter = “0s”

flush_interval = “1s”

flush_jitter = “0s”

precision = “ns”

debug = false

quiet = false

#hostname = “”

After playing around it looks like around interval = 5 ms ist the minimum value before getting constantly missing values like this:

2021-12-07T09:29:32Z W! [inputs.opcua] Collection took longer than expected; not complete after interval of 5ms

The flush_interval looks like not to have a big influence?

Hi @Manfred,
I agree with you in its current guise the OPC UA client needs some work. As you have already discovered the client essentially polls the server on each interval. Telegraf was not built to poll at that frequency.

I will turn this into a feature request for the OPC-UA rewrite where we look to use a subscription model equivalent to our MQTT client. Essentially when a monitored tag changes state we also collect this state. Then we deliver these samples to your output plugin under the usual flush interval. There are a few other major changes we are looking to add in the rewrite which can be found here: OPC-UA input plugin roadmap · Issue #10062 · influxdata/telegraf · GitHub

2 Likes

Hi @Manfred,
Here is the issue: OPC UA Client to support Data Change Subscription · Issue #10235 · influxdata/telegraf · GitHub

Please add any additional comments there :slight_smile: . Having a real-life use case pushes the ticket forward.

2 Likes