Telegraf keeps getting disconnected and connects again with opcua

Hello all,

I am using opcua telegraf plugin to collect data but for some reason based on telegraf logs it keeps disconnecting from opcua and connectes again. this happens in random time interval.

This are the telegraf logs that i’m getting.

2023-04-11T04:37:00Z D! [inputs.opcua] Disconnecting from OPC UA Server
2023-04-11T04:37:00Z E! [inputs.opcua] Error in plugin: RegisterNodes Read failed: The session id is not valid. StatusBadSessionIDInvalid (0x80250000)
2023-04-11T04:38:00Z D! [inputs.opcua] Connecting OPC UA Client to server
2023-04-11T04:38:00Z D! [inputs.opcua] Configuring OPC UA connection options
2023-04-11T04:38:00Z W! [inputs.opcua] Failed to load certificate: open /etc/telegraf/cert.pem: The system cannot find the path specified.
2023-04-11T04:38:00Z D! [inputs.opcua] security policy from configuration Profile Reporting Links
2023-04-11T04:38:00Z D! [inputs.opcua] User cares about both the policy (Profile Reporting Links) and security mode (MessageSecurityModeNone)
2023-04-11T04:38:00Z D! [inputs.opcua] Server has 1 endpoints
2023-04-11T04:38:00Z D! [inputs.opcua] Evaluating endpoint opc.tcp://10.0.0.5:49320, policy Profile Reporting Links, mode MessageSecurityModeNone, level 16
2023-04-11T04:38:00Z D! [inputs.opcua] Security policy and mode found. Using server endpoint opc.tcp://10.0.0.5:49320 for security. Policy Profile Reporting Links
2023-04-11T04:38:00Z D! [inputs.opcua] Connected to OPC UA Server

This keeps happening and i am losing data within that time interval.

can some on help me with this. Thanks

Could you share your config as well? The only suggestion I may have is based on comments from the go-opcua maintainer around when using registered nodes

This is the telegraf config that i am using to collect data

config.txt (7.7 KB)

I’m having a similar problem.

2024-05-15T11:32:35Z E! [inputs.opcua] Error in plugin: RegisterNodes Read failed: The session id is not valid. StatusBadSessionIDInvalid (0x80250000)
2024-05-15T11:32:37Z E! [inputs.opcua] Error in plugin: RegisterNodes Read failed: The session id is not valid. StatusBadSessionIDInvalid (0x80250000)
2024-05-15T11:32:43Z W! [inputs.opcua] Failed to load certificate: open /etc/telegraf/cert.pem: no such file or directory

Also recognized when a node is temporary not available the opc ua plugin does not handle the exception. The entie session is reset.

2024-05-15T11:32:35Z E! [inputs.opcua] Error in plugin: RegisterNodes Read failed: The session id is not valid. StatusBadSessionIDInvalid (0x80250000)
2024-05-15T11:32:37Z E! [inputs.opcua] Error in plugin: RegisterNodes Read failed: The session id is not valid. StatusBadSessionIDInvalid (0x80250000)
2024-05-15T11:32:43Z W! [inputs.opcua] Failed to load certificate: open /etc/telegraf/cert.pem: no such file or directory

Anyone ever figure out a solution to this issue? I’m getting the same disconnect-reconnect error as the OP.