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:
- cnquery installed on your workstation.
- Network access to the OPC UA endpoint on the industrial device.
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... |
|---|---|
| HOST | The industrial system hostname or IP address |
| PORT | The OPC UA server port (typically 4840) |
For example, to connect to a PLCnext controller:
cnquery shell opcua --endpoint opc.tcp://192.168.1.50:4840Example 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
-
To learn more about how the MQL query language works, read Write Effective MQL.
-
For a list of all the OPC UA resources and fields you can query, read the OPC UA Resource Pack Reference.