OPCUA, secure channel not open

Hi,

We use Telegraf to read data from a KEPWareEX server through OPC/UA and it returns following error after some time of operation:

2021-07-13T18:41:30Z E! [inputs.opcua] Error in plugin: opcua: sechan: secure channel not open.

We’ve been trying to debug the plugin and it seems to go wrong when trying to reconnect to the KEPWareEX server. Did anyone experience the same issues and what could be a possible solution?

Thanks!

2 Likes

Did you find any solution for this problem? I am also using Kepware Server to read, through Modbus TCP, tags from diffirent devices. When i run Telegraf.conf everything is working fine at the beginning and a few minutes later, i get the same error message as you.
Thanks

Hi,

Yes, I found a solution.

I re-worked the code of the OPC/UA connector a bit and was planning to make a suggestion for this, as soon as I can find some time to make a pull request.

It goes wrong when the connection is re-initiated by the opcua input plugin. On line 408 the existing connection is closed, but it was already closed by the OPC/UA server. This resulted in an error being thrown. Instead of throwing an exception I just print an error message.

		if o.client != nil {
			if err := o.client.CloseSession(); err != nil {
				print("Error while closing connection: " + err.Error())
			}
		}

After rebuilding the application it worked perfectly for me.
Hope this helps!

2 Likes

Thank you very much!!! I will try it!

It appears that (a slight variation on) your solution is added in fix: Do not return on disconnect to avoid breaking reconnect (#9524) · influxdata/telegraf@249bcd2 · GitHub
which is included since the 1.19.3 release
Release v1.19.3 · influxdata/telegraf · GitHub

Thank you!