Issue with Telegraf OPC UA Input Plugin

Hello everyone,

I’m having an issue with the Telegraf OPC UA Client Input Plugin.
I want to collect machine Data from a Fanuc OPC UA Server [running on a VM] with Telegraf, write the data to an InfluxDB2 an visualize everything with grafana.
Now I’m having trouble with the data collection part. The telegraf log always tells me, that the node does not exist in the server adress space.
I double checked my telegraf.conf and verified that the node is existing and available with the UaExpert Client [see screenshot] and a nodejs opcua client.
Has anyone an idea how to solve this issue?

Thanks in advance,
Joachim

Ua Expert Screenshot:

Log of my telegraf docker container:

2021-10-21T08:16:49Z I! Starting Telegraf 1.20.2,
2021-10-21T08:16:49Z I! Using config file: /etc/telegraf/telegraf.conf,
2021-10-21T08:16:49Z I! Loaded inputs: opcua,
2021-10-21T08:16:49Z I! Loaded aggregators: ,
2021-10-21T08:16:49Z I! Loaded processors: ,
2021-10-21T08:16:49Z I! Loaded outputs: influxdb_v2,
2021-10-21T08:16:49Z I! Tags enabled: host=f4a9b73bb9fb,
2021-10-21T08:16:49Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"f4a9b73bb9fb", Flush Interval:10s,
2021-10-21T08:16:49Z I! Failed to load certificate: open /etc/telegraf/cert.pem: no such file or directory,
2021-10-21T08:16:50Z E! [inputs.opcua] status not OK for node ServerVersion: The node id refers to a node that does not exist in the server address space. StatusBadNodeIDUnknown (0x80340000)

Because I’m a new user I’m not allowed to upload attachments so here is the content of my telegraf.conf:

[global_tags]


# Configuration for telegraf agent
[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  hostname = ""
  omit_hostname = false

###############################################################################
#                            OUTPUT PLUGINS                                   #
###############################################################################

# # Configuration for sending metrics to InfluxDB
[[outputs.influxdb_v2]]
  urls = ["http://influxdb:8086"]
#
#   ## Token for authentication.
  token = "myInfluxDBToken"
#
#   ## Organization is the name of the organization you wish to write to; must exist.
  organization = "MyOrganization"
#
#   ## Destination bucket to write into.
  bucket = "MyBucket"

###############################################################################
#                            INPUT PLUGINS                                    #
###############################################################################

# # Retrieve data from OPCUA devices
[[inputs.opcua]]
  ## Metric name
  name = "opcua"
  #
  ## OPC UA Endpoint URL
  endpoint = "opc.tcp://172.20.103.175:59611"
  # endpoint = "opc.tcp://FANUC-OPC:59611"
  #
  ## Maximum time allowed to establish a connect to the endpoint.
  connect_timeout = "10s"
  #
  ## Maximum time allowed for a request over the estabilished connection.
  request_timeout = "5s"
  #
  ## Security policy, one of "None", "Basic128Rsa15", "Basic256",
  ## "Basic256Sha256", or "auto"
  security_policy = "None"
  #
  ## Security mode, one of "None", "Sign", "SignAndEncrypt", or "auto"
  security_mode = "None"
  #
  ## Path to cert.pem. Required when security mode or policy isn't "None".
  ## If cert path is not supplied, self-signed cert and key will be generated.
  # certificate = "/etc/telegraf/cert.pem"
  #
  ## Path to private key.pem. Required when security mode or policy isn't "None".
  ## If key path is not supplied, self-signed cert and key will be generated.
  # private_key = "/etc/telegraf/key.pem"
  #
  ## Authentication Method, one of "Certificate", "UserName", or "Anonymous".  To
  ## authenticate using a specific ID, select 'Certificate' or 'UserName'
  auth_method = "UserName"
  #
  ## Username. Required for auth_method = "UserName"
  username = "username"
  #
  ## Password. Required for auth_method = "UserName"
  password = "password"
  nodes = [
    {name="ServerVersion", namespace="2", identifier_type="s", identifier="SVR.SERVER_VERSION"}
  ]

Hi @joschott ,
Nice to meet you digitally and awesome to see you using Fanuc! I also use to work with there OPC-UA endpoints in the past.

Interesting issue, I had a test on my simulation server and could not achieve the same error. What version of Telegraf are you using? Also, do you receive the same result when trying to collect from a numerical tag?

Thanks in advance!

Hi @Jay_Clifford,
thanks for your reply! :blush:
I’m using Telegraf 1.20.2.

I adjusted my telegraf.conf to listen to a numeric server node and I’m actually getting values into my influxDB bucket :+1:

Unfortunately all of the Fanuc machine data nodes that are of interest to me have the identifier-type: “s” [string] and the Fanucs OPC Configurator does not let me change the identifier-type

Do you have any idea how to solve this?

my guess is that string values get stored as tags instead of fields, if there are no fields in the point then the point itself invalid (gets discarded).

I had a look at the opcua input and I’m not sure about the name of the fields that should be created (the example uses “Temp” as field name).

In order to convert tags to string fields you need to know the exact name of the tag/field and use the converter processor

Sorry, I am a little late back on this one. @Giovanni_Luisotto I believe the string values should come through as fields. I tested this against a simulation server and managed to pull in the string results as fields.

@joschott I have raised this with the Telegraf team. We are looking to do a re-write of the OPC-UA client in the future. The last thought I had on the matter is that are you using the same user for both your UA expert client and Telegraf. Just wondered if there might be a permissions issue on the string tags

1 Like

Hi @Jay_Clifford,
thanks for your reply. I’m using the same user for the UA Expert and Telegraf Client.

Because I couldn’t get it to work I opted for the solution with the node-opcua-client. I’m getting the results I need, but it’s frustrating that I haven’t got the Telegraf client to work which would’ve been more elegant.
If I have spare time in the future I’ll try to get it running.
Thanks for your time you all! :slight_smile:

Hi @joschott ,
Thank you for your reply. It’s a shame we couldn’t get that sorted for you in time. Would you be open to the possibility of us sending you pre-release builds in the future? It’s vital for us to work with automation experts such as yourself in the future to make sure we get the plugin right :slight_smile:

Hi @Jay_Clifford,
yeah I’m open to that. Just hit me up when you’re ready.

1 Like

Hello,

I’m struggling with a similar issue, my node-id looks like this:

NS3|String|"Logg_DB"."UV"

and I’m not sure how to write this in the .conf file. I’ve tried:

{name="UV", namespace="3", identifier_type="s", identifier="Logg_DB\".\"UV"}

and some variations…

From the posts above, it seems like this will not work with string identifier?

There is a possibility for us to change the identifier type, but it will involve some external help.

Any update on the rewrite? :upside_down_face:

Hi @OdneOksavik,
Welcome to the community :). I have raised this issue again in our weekly Telegraf maintainers meeting. Just to confirm that you are experiencing this issue even when specifying the identifier like so:
{name="UV", namespace="3", identifier_type="s", identifier="Logg_DB.UV"}

Hi, and thank you for reaching out. I now tried specifying the identifier like you recommended. I get the following in my status:

[inputs.opcua] status not OK for node UV: The node id refers to a node that does not exist in the server address space. StatusBadNodeIDUnknown (0x80340000)

Hi, I just wanted to follow up. We ended up having our supplier change the identifier type from string to numeric, and now the OPC UA plugin works as expected.

Hi @OdneOksavik,
Sorry for not getting back sooner. If my name isn’t tagged in the post it gets lost to the great beyond sometimes. I am glad it has been sorted in the meantime. We are still actively looking into the issue to see what might be causing the problem.

@OdneOksavik

I’m facing similar formatting on one of my OPC UA servers (a Siemens PLC). For your specific node:

NS3|String|"Logg_DB"."UV"

the config would have been:

{name="UV", namespace="3", identifier_type="s", identifier='"Logg_DB"."UV"'}

Note that I’m making use of the TOML literal strings with single quotes. See TOML: Tom's Obvious Minimal Language

2 Likes

Thank you @R290, I don’t think I tried this syntax.
We have now transitioned to numeric identifier, but I might try to see if there are some OPC UA tags with string identifier, just to test this.

Hopefully someone else will benefit from you comment down the line. :slight_smile:
Have a nice day!

Hi @Jay_Clifford,

I am having the same issue as the original post regarding Fanuc OPC server. Checking to see if there has been any progress on this issue before I pursue other options.

Thanks!