Telegraf plugin


I have some remarks about telegraf plugin. Some of them are issues and the other are propositions. Telegraf OPC-UA Plugin :

  1. Can we add tags from collected variables ? It will be nice if we can add some non static Tags.
  2. Can we change the group measurement name with a variable collected. Converters are not the solution since it change only for one measurement not the group measurement name.
  3. The timestamp collected with the plugin Telegraf is neither Source Timestamp nor Server Timestamp of the opc ua. (issue). If you can tell which timestamp collected with the plugin.

thank you a lot for your support.


Hi Anis,

for question 1., I’m not 100% sure if I know what you mean. There is a tags config option for inputs if you want to hardcode some tag values, but if you want to add dynamic tags, you could potentially use the starlark processor for this. But please clarify an example if I’m misunderstanding. Thanks!

for question 2., I believe you can use the name_override input configuration to change the measurement name for all metrics that are reported for your given input. If you need to change it in different or more complex ways then simply changing it to the same value each time, again starlark would help you write custom processing logic that can alter each metric. Let me know if that makes sense or if you have a different use case in mind.

for question 3., it looks like the OPC-UA plugin is going to use a default timestamp, which is always going to be the exact time that telegraf gathers the metric.

hello @David_Bennett ,

I would like to thank you for your answers.
Here you find an example for all the questions :

  tags=[["Machine", "75481"]]
  nodes = [
    {name="No of machine cycles", identifier="25426206392354"},
    {name="Current Product Reference", identifier="708360366194724"},
    {name="No of good parts", identifier="25426206392380"},
    {name="No of bad parts", identifier="25426206392378"}

For the first question :
you can see that this is a static tag.
tags=[[“Machine”, “75481”]]
I cannot add some tags collected from OPC_UA:
For exemple :
Can I add this variable “Current Product Reference” as a tag_key and the tag_value will be the value collected from opc_ua.

For the second question :
Imagine that I need the “Current Product Reference” will be the measurement name for all the group not only for the second node as done with [processors.converter]

For the third question :
Your answer is clear.

Thank you for your help.

For the first question, I’m not 100% sure if there’s an out of box way to do this, but I believe you can use the starlark processor to accomplish this. You’d copy the value of the field that you want, and add a new tag with that value. Basically the processor allows you to write basic code to manipulate metrics in a python-like dialect. Check out examples here: telegraf/plugins/processors/starlark/testdata at master · influxdata/telegraf · GitHub.

For the second question, I believe name_override will let you name all metrics that come out of the plugin, not just some of them. so if you set it to “Current Product Reference”, I believe they’ll all come out that way. See how it’s used and more config tricks here: Configuring Telegraf | Telegraf 1.18 Documentation.

Please let us know if you have further questions