Telegraf OPC UA Input Data Example (from TwinCat Server)

I try to get som values as Input from a OPC-UA Server (Twincat3).
In my InfluxDB Bucket are no results.
Can anybody help me to find the error? At the moment I have no more ideas how to fix this…

What can fix this issue:

panic: runtime error: invalid memory address or nil pointer dereference

Telegraf config:

### Configuration for telegraf agent
[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 = ""


[[outputs.influxdb_v2]]	
   urls = ["http://localhost:8086"]
  token = "$INFLUX_TOKEN"
  organization = "MasterOrg"
  bucket = "opc1"


[[inputs.opcua]]
  ## Metric name
  name = "opc1"
  #
  ## OPC UA Endpoint URL
#endpoint = "opc.tcp://localhost:4840"
  endpoint = "opc.tcp://Manu:4840"
 # endpoint = "opc.tcp://192.168.1.197:4870"

  ## 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 = "Basic256Sha256"
  security_policy = "None"
  #
  ## Security mode, one of "None", "Sign", "SignAndEncrypt", or "auto"
  #security_mode = "Sign"
  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 = "/Program Files/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 = "/Program Files/Telegraf/key.pem"
  #
  ## Authentication Method, one of "Certificate", "UserName", or "Anonymous".  To
  ## authenticate using a specific ID, select 'Certificate' or 'UserName'
  auth_method = "Anonymous"
  #
  ## Node ID configuration
  ## name              - field name to use in the output
  ## namespace         - OPC UA namespace of the node (integer value 0 thru 3)
  ## identifier_type   - OPC UA ID type (s=string, i=numeric, g=guid, b=opaque)
  ## identifier        - OPC UA ID (tag as shown in opcua browser)
  ## tags              - extra tags to be added to the output metric (optional)
  ## Example:
 #nodes = [ {name="", namespace="", identifier_type="", identifier=""} ]

  nodes = [
  {name="opc1", namespace="4",identifier_type="i", identifier="MAIN.ncounter"},
  {name="test2", namespace="3",identifier_type="i", identifier="MAIN.nNumber"},
  {name="test3", namespace="4",identifier_type="i", identifier="MAIN.iVar2"},
  ]

CLI Information when starting Telegraf:

PS C:\Program Files\Telegraf> .\telegraf --config http://127.0.0.1:8086/api/v2/telegrafs/085b26bd1dbcd000

.\telegraf : 2021-10-29T07:58:24Z I! Starting Telegraf 1.19.2
In Zeile:1 Zeichen:1
+ .\telegraf --config http://127.0.0.1:8086/api/v2/telegrafs/085b26bd1d ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (2021-10-29T07:5...Telegraf 1.19.2:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
2021-10-29T07:58:24Z I! Loaded inputs: opcua
2021-10-29T07:58:24Z I! Loaded aggregators: 
2021-10-29T07:58:24Z I! Loaded processors: 
2021-10-29T07:58:24Z I! Loaded outputs: influxdb_v2
2021-10-29T07:58:24Z I! Tags enabled: host=Manu
2021-10-29T07:58:24Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"Manu", Flush Interval:10s
2021-10-29T07:58:24Z I! Failed to load certificate: open /etc/telegraf/cert.pem: Das System kann den angegebenen Pfad nicht finden.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x2398ab9]
goroutine 22 [running]:
github.com/gopcua/opcua/ua.(*NodeID).Encode(0x0, 0x47f7500, 0x0, 0x23d7d51d678, 0x0, 0x0)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/node_id.go:398 +0x59
github.com/gopcua/opcua/ua.encode(0x47f7500, 0xc0000a3460, 0x196, 0xc0007f6270, 0x2b, 0xc0000a3460, 0x196, 0x8, 0x0, 0x3cf8b7e)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:46 +0xccf
github.com/gopcua/opcua/ua.writeSlice(0x3f6e1a0, 0xc0000a3b08, 0x197, 0xc0007f6240, 0x28, 0x136cdc, 0x28, 0xc0007f6240, 0x28, 0xc0007f6240)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:131 +0x2ff
github.com/gopcua/opcua/ua.encode(0x3f6e1a0, 0xc0000a3b08, 0x197, 0xc0007f6240, 0x28, 0xc0000a3b08, 0x197, 0xc0007f6240, 0x28, 0x0)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:85 +0xa87
github.com/gopcua/opcua/ua.writeStruct(0x444c8e0, 0xc0000a3b00, 0x199, 0x3d3144f, 0x18, 0x42549f8, 0xc000105080, 0x3c7c504, 0xc000105080, 0x3c6c76f)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:99 +0x265
github.com/gopcua/opcua/ua.encode(0x444c8e0, 0xc0000a3b00, 0x199, 0x3d3144f, 0x18, 0x199, 0x145e7c, 0x41908c0, 0x0, 0xc0003b0aa0)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:83 +0xb31
github.com/gopcua/opcua/ua.encode(0x42549c0, 0xc0000a3b00, 0x16, 0x3d3144f, 0x18, 0xc0007998b0, 0x4, 0xc0007998c0, 0x23d7d51da00, 0xc000559808)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:81 +0x993
github.com/gopcua/opcua/ua.Encode(0x42549c0, 0xc0000a3b00, 0xc0000a3b00, 0x0, 0x0, 0x0, 0x4)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:34 +0x118
github.com/gopcua/opcua/ua.(*Buffer).WriteStruct(0xc000559958, 0x42549c0, 0xc0000a3b00)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/buffer.go:306 +0x67
github.com/gopcua/opcua/uasc.(*Message).Encode(0xc0000a3b60, 0x53c2d98, 0xc0000a3b00, 0xc000000004, 0xc000288690, 0x12a05f200)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/uasc/message.go:125 +0x137
github.com/gopcua/opcua/uasc.(*SecureChannel).sendAsyncWithTimeout(0xc0002e8d10, 0x53c2d98, 0xc0000a3b00, 0xc000000004, 0xc00042c480, 0xc000288690, 0x23c4601, 
0x12a05f200, 0xc000288690, 0x12a05f200, ...)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/uasc/secure_channel.go:701 +0x145
github.com/gopcua/opcua/uasc.(*SecureChannel).sendRequestWithTimeout(0xc0002e8d10, 0x53c2d98, 0xc0000a3b00, 0x4, 0xc00042c480, 0xc000288690, 0x12a05f200, 0xc000559c90, 
0x0, 0x0)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/uasc/secure_channel.go:622 +0xbe
github.com/gopcua/opcua/uasc.(*SecureChannel).SendRequestWithTimeout(0xc0002e8d10, 0x53c2d98, 0xc0000a3b00, 0xc000288690, 0x12a05f200, 0xc000559c90, 0x8, 0x4254a40)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/uasc/secure_channel.go:681 +0xd5
github.com/gopcua/opcua.(*Client).sendWithTimeout(0xc000493880, 0x53c2d98, 0xc0000a3b00, 0x12a05f200, 0xc000559c90, 0xef03f, 0x20)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/client.go:451 +0xbf
github.com/gopcua/opcua.(*Client).Send(...)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/client.go:437
github.com/gopcua/opcua.(*Client).RegisterNodes(0xc000493880, 0xc0000a3b00, 0xc00042c2a0, 0x0, 0x0)
	/go/pkg/mod/github.com/gopcua/opcua@v0.1.13/client.go:552 +0x96
github.com/influxdata/telegraf/plugins/inputs/opcua.Connect(0xc0006c4180, 0x0, 0x0)
	/go/src/github.com/influxdata/telegraf/plugins/inputs/opcua/opcua_client.go:420 +0x325
github.com/influxdata/telegraf/plugins/inputs/opcua.(*OpcUA).Gather(0xc0006c4180, 0x5445078, 0xc000629d80, 0x0, 0x0)
	/go/src/github.com/influxdata/telegraf/plugins/inputs/opcua/opcua_client.go:516 +0x58c
github.com/influxdata/telegraf/models.(*RunningInput).Gather(0xc0007b6410, 0x5445078, 0xc000629d80, 0x0, 0x0)
	/go/src/github.com/influxdata/telegraf/models/running_input.go:117 +0x74
github.com/influxdata/telegraf/agent.(*Agent).gatherOnce.func1(0xc000428300, 0xc0007b6410, 0x5445078, 0xc000629d80)
	/go/src/github.com/influxdata/telegraf/agent/agent.go:469 +0x46
created by github.com/influxdata/telegraf/agent.(*Agent).gatherOnce
	/go/src/github.com/influxdata/telegraf/agent/agent.go:468 +0xc5

Anybody knows what issues can lead to this error?