Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPCUA - Access session timeout parameter from Telegraf #15258

Closed
maxime-jolliet-airseas opened this issue Apr 29, 2024 · 1 comment · Fixed by #15341
Closed

OPCUA - Access session timeout parameter from Telegraf #15258

maxime-jolliet-airseas opened this issue Apr 29, 2024 · 1 comment · Fixed by #15341
Labels
feature request Requests for new plugin and for new features to existing plugins help wanted Request for community participation, code, contribution size/s 1 day effort, great beginniner issue

Comments

@maxime-jolliet-airseas
Copy link
Contributor

maxime-jolliet-airseas commented Apr 29, 2024

Use Case

Telegraf uses default session configuration parameters from gopcua, as defined here : https://github.com/gopcua/opcua/blob/main/config.go#L40

Namely, the session timeout is set to 20 minutes. I connect to PLC that have only a few PCUA session slots available (typically, 5 to 10). Often, I max out the session slots (I do not know why), and end up with a "BadTooManySessionError" - and have to wait for the 20 minutes timout to expire.

Expected behavior

I'd like to add a parameter to Telegraf OPCUA plugins configuration "session_timeout".

  ## Maximum time a session can be inactive. The server will kill these sesion, if the client has died or is no longer connected to the server .
  connect_timeout = "20s"

Actual behavior

I am not aware of any workaround, sadly.

Additional info

I don't know Go, but I can try to start a PR, if that's OK.

@maxime-jolliet-airseas maxime-jolliet-airseas added the feature request Requests for new plugin and for new features to existing plugins label Apr 29, 2024
@powersj
Copy link
Contributor

powersj commented Apr 29, 2024

Hi,

Happy to see a PR with this config option exposed. I believe you would want to look at plugins/common/opcua/client.go and expose a SessionTimeout variable called session_timeout in the TOML config.

Then in plugins/common/opcua/opcua_util.go, in the generateClientOpts function, set the timeout option.

Finally, update the sample.conf and README.md with the new option you have added.

@powersj powersj added help wanted Request for community participation, code, contribution size/s 1 day effort, great beginniner issue labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new plugin and for new features to existing plugins help wanted Request for community participation, code, contribution size/s 1 day effort, great beginniner issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants