Parse OPC data in telegraf plugin

Hello, I want to parse opc data using telegraf plugin.
my data _value format is [Valuename,01,02,03]
and I want to separate the field of value(01,02,03).
can I do that in inputs.opcua plugin? and how I can do?

Hi,

Are you using the OPC UA input plugin to collect this data and then want to parse it before it goes to an output? If you have a config already collecting data using opc ua can you show us what you have so far?

Thanks!

yes, I use OPCUA input plugin to collect my data.
and I want to parse it before(or when) it goes to Influx data.

[agent]
  interval = "1s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 1000
  flush_interval = "10s"
  omit_hostname = true
  collection_jitter = "0s"
  flush_jitter = "0s"
  debug = false
  quiet = false

 
[[inputs.opcua]]
  name = "opcua"
  endpoint = ""
  connect_timeout = "10s"
  request_timeout = "5s"
  security_policy = "auto"
  security_mode = "auto"

   nodes = [
   {name="WIVS", namespace="2", identifier_type="s", identifier="WCha1.WDevice1.IVS"}
   ]

And the output value format is “[IVS,0,0,0]”.

I would probably use something like the Starlark processor to break the values apart. @Jay_Clifford are you aware of any other good method with OPC UC to then break apart the received string? Or is there a more native way to query this value?

2 Likes

I would agree with you @jpowers it looks like the tag identifier type is a string. So the best thing to do would be to break it down into metrics via Starlark. Something along the lines of convert string to array → iterates over array → save values to fields.

We are working on a new blog with best practices and work around for this sort of thing. Will make sure to add it to the list!

1 Like