Operating Systems

Query OPC UA Industrial Systems

Query Linux-based industrial systems via OPC UA with cnquery

Rely on cnquery to query Linux-based industrial control systems through the OPC UA (Open Platform Communications Unified Architecture) protocol. This provider is designed for industrial automation systems such as Phoenix Contact PLCnext controllers that run Linux-based operating systems.

Requirements

To analyze and explore your industrial systems with cnquery, you must have:

Connect to an industrial system

To query a Linux-based industrial system via OPC UA, provide the endpoint URL:

cnquery shell opcua --endpoint opc.tcp://HOST:PORT
For...Substitute...
HOSTThe industrial system hostname or IP address
PORTThe OPC UA server port (typically 4840)

For example, to connect to a PLCnext controller:

cnquery shell opcua --endpoint opc.tcp://192.168.1.50:4840

Example queries

Once connected, you can query the industrial system's resources.

This query retrieves information about the OPC UA server:

cnquery> opcua.server
opcua.server: {
  ...
}

This query retrieves all namespaces:

cnquery> opcua.namespaces
opcua.namespaces: [
  0: opcua.namespace name="http://opcfoundation.org/UA/"
  ...
]

This query retrieves the root node:

cnquery> opcua.root
opcua.root: opcua.node id="i=84" name="Root"

This query lists all nodes:

cnquery> opcua.nodes
opcua.nodes: [
  0: opcua.node id="i=84" name="Root"
  1: opcua.node id="i=85" name="Objects"
  ...
]

Exit the cnquery shell

To exit the cnquery shell, either press Ctrl + D or type exit.

Learn more

On this page