Grouping OPC UA values read from Siemens PLC Datablock

Hi Team,
Loving Telegraf, yet still somewhat of a NOOB.
I’m reaching OPC UA from Siemens PLC. Below is config from “Paper” machine.
I’m getting data flowing, but I’m wondering if I can improve output.

Right now Rows of data are:
Paper Total OK value
Paper Total NOK value

I was wondering if it is possible to have more structure

Paper
Total OK Value
Total NOK Value

[[inputs.opcua_listener]]
endpoint = “opc.tcp://10.10.1.32:5775”
nodes = [
{name=“Paper Total OK”, namespace=“2”, identifier_type=“s”, identifier=“/Plc/DB59.DBW1006”},
{name=“Paper Total NOK”, namespace=“2”, identifier_type=“s”, identifier=“/Plc/DB59.DBW1010”},
{name=“Paper Day OK”, namespace=“2”, identifier_type=“s”, identifier=“/Plc/DB59.DBW1012”},
{name=“Paper Day NOK”, namespace=“2”, identifier_type=“s”, identifier=“/Plc/DB59.DBW1014”},
{name=“Paper Shift OK”, namespace=“2”, identifier_type=“s”, identifier=“/Plc/DB59.DBW1016”},
{name=“Paper Shift NOK”, namespace=“2”, identifier_type=“s”, identifier=“/Plc/DB59.DBW1018”}
]

I tried using the [[inputs.opcua_listener.group]] but couldn’t make heads or tails out of things.

Thank you in advance for any advice you can throw my way.

Any help is very much appreciated.

~Bryan

Hi,

I’m not sure I follow what your desired end state is. My suggestion is to show what metrics you are generating via the [[outputs.file]] output, and then show how you want them to eventually look like. Basically a before and after and we can see what you might be able to do.

Hi @jpowers,
Thanks for response and suggestion.

I have pasted the metrics.out below. My thinking was to be able to view Paper machine, and measures below it:

  • Paper
    • Paper Total OK Parts
    • Paper Total NOK Parts
    • Paper Shift OK Parts
    • Paper Shift NOK Parts

I think my current telegraf.conf is just setting each measurement on the “same level” with no hierarchy.

Here is log:

opcua,host=dashboardpi,id=ns=2;s=/Plc/DB59.DBW1006 Paper\ Total\ OK=0i,Quality=“OK (0x0)” 1708158106545422246
opcua,host=dashboardpi,id=ns=2;s=/Plc/DB59.DBW1010 Paper\ Total\ NOK=23i,Quality=“OK (0x0)” 1708158106545448616
opcua,host=dashboardpi,id=ns=2;s=/Plc/DB59.DBW1012 Paper\ Day\ OK=556i,Quality=“OK (0x0)” 1708158106545460560
opcua,host=dashboardpi,id=ns=2;s=/Plc/DB59.DBW1014 Paper\ Day\ NOK=20i,Quality=“OK (0x0)” 1708158106545471616
opcua,host=dashboardpi,id=ns=2;s=/Plc/DB59.DBW1016 Paper\ Shift\ OK=173i,Quality=“OK (0x0)” 1708158106545498504
opcua,host=dashboardpi,id=ns=2;s=/Plc/DB59.DBW1018 Paper\ Shift\ NOK=12i,Quality=“OK (0x0)” 1708158106545515393

I hope that I’m explaining myself.

Thank you in advance for any tips you can provide.

Thanks,
~Bryan

Hi @jpowers,
I am able to read data, but still not sure if my strategy is correct. For instance to output to MQTT_Server, my topics were getting splits. I can rename my node names to use underscores, etc.

Any guidance is very much appreciated.

Thanks,
~Bryan

Thanks for showing the metrics you are getting.

What do you mean by this? I’m still not sure what your goal metric would look like. Can you modify that line protocol that you are getting to make it look like what you want?

Hi @jpowers,
Thanks for response.

My desire is to be able to view values for our Paper machine, but I think my telegraf.conf is not setup properly. I’m simply looking for value measurement like:

Just for nomenclature: OK means an OK part, NOK means a “Not OK”. Each have count values.

Paper Machine
---- Paper Day OK
---- Paper Day NOK

When viewing the log, you see line protocol is storing name as “Paper Shift OK” below example shows value of 173. Normally this would be no problem, but when I also output to MQTT, the topic name changes to be Paper\Shift\OK\173.

Additionally, my goal is to simply look at “Paper machine” and see all measurements underneath.

opcua,host=dashboardpi,id=ns=2;s=/Plc/DB59.DBW1016 Paper\ Shift\ OK=173i,Quality=“OK (0x0)” 1708158106545498504
opcua,host=dashboardpi,id=ns=2;s=/Plc/DB59.DBW1018 Paper\ Shift\ NOK=12i,Quality=“OK (0x0)” 1708158106545515393

I hope this is clearer.

Thank you again in advance!

Kind Regards,
~Bryan

This has to do with MQTT topics not having spaces in them. If you want to rename the filed first then, consider the rename processor.

Additionally, my goal is to simply look at “Paper machine” and see all measurements underneath.

I assume you are referring to how things show up in MQTT. You haven’t shared your config.

I hope this is clearer.

Not quite yet as you just copied and pasted two of the lines that you are getting without any changes :wink: