Skip to content

Conversation

@skartikey
Copy link
Contributor

Summary

Adds support for OPC UA namespace URIs (nsu=) as an alternative to namespace indices (ns=) in both inputs.opcua and inputs.opcua_listener plugins.
This enhancement allows users to configure nodes using stable namespace URIs instead of numeric indices that can change when OPC UA servers restart, making configurations more robust and portable.

New Configuration Option

  • Added namespace_uri field to node and group configurations
  • Supports both regular nodes and event nodes
  • Works alongside existing namespace (index) field with mutual exclusion validation

Example Usage

Before (using namespace index):

 [[inputs.opcua.nodes]]
   name = "Temperature"
   namespace = "3"
   identifier_type = "s"
   identifier = "Temperature"

After (using namespace URI):

 [[inputs.opcua.nodes]]
   name = "Temperature"
   namespace_uri = "http://opcfoundation.org/UA/"
   identifier_type = "i"
   identifier = "2255"

Breaking Changes
None - this is purely additive. Existing configurations using namespace continue to work unchanged.

Checklist

Related issues

resolves #14417

Add support for OPC UA namespace URIs (nsu=) as an alternative to namespace indices (ns=) in both inputs.opcua and inputs.opcua_listener plugins. This allows users to configure nodes using stable namespace URIs instead of numeric indices that can change on server restart.
@telegraf-tiger telegraf-tiger bot added area/opcua feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Oct 29, 2025
Add namespace_uri field to sample configuration for both inputs.opcua and inputs.opcua_listener plugins.
@skartikey skartikey marked this pull request as draft October 29, 2025 18:14
@skartikey skartikey marked this pull request as ready for review November 7, 2025 17:30
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Nov 7, 2025

Comment on lines +274 to +280
```toml
[[inputs.opcua.nodes]]
name = "ServerStatus"
namespace = "0"
identifier_type = "i"
identifier = "2256"
```
Copy link
Member

@srebhan srebhan Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question for understanding the matter. As we touch this part anyway, wouldn't it be easier do define something like

[inputs.opcua_listener.metric]
  name = "my_metric"
  [inputs.opcua_listener.metric.fields]
    ServerStatus = "ns=0;i=2256"
    MyInfo  = "nsu=http://opcfoundation.org/UA/;s=foo"
  [inputs.opcua_listener.metric.tags]
    location = "main building"
    device = "typesetter"

This is more compact, less error prone (you cannot define duplicate fields) and easier to graps as it defines how a metric looks like and uses the notation used for Node IDs in OPCUA, isn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's implement the feature in the current form and add the more compact configuration later if we want to...

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @skartikey!

@srebhan srebhan changed the title feat(inputs.opcua): Add namespace URI support for stable node references feat(inputs.opcua): Add namespace URI support Nov 13, 2025
@srebhan srebhan removed their assignment Nov 13, 2025
@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Nov 13, 2025
@mstrandboge mstrandboge merged commit ede04c6 into influxdata:master Nov 20, 2025
28 of 29 checks passed
@github-actions github-actions bot added this to the v1.37.0 milestone Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/opcua feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OPC UA listener input. Support for nsu Identifier and OPC naming rules.

3 participants