Skip to content

opcuactl

opcuactl is a single-binary OPC UA client for the terminal, built on go-opcua. It discovers servers and endpoints, browses and searches the address space, reads and writes values, calls methods, monitors data changes, events and alarms, acknowledges and shelves alarms, reads server diagnostics, manages certificates and trust lists (GDS push and pull), reads and edits data and event history, exports subtrees, and listens to, publishes and configures OPC UA PubSub. It connects over opc.tcp, and over opc.wss and opc.https in UA Binary or UA JSON. opcuactl serve runs a test server, so all of this can be tried without a PLC. Every command prints a table, JSON, YAML, CSV or JSON Lines and reports failures through stable exit codes. This page describes v0.14.1, which is built on go-opcua v1.31.0.

Terminal window
curl -fsSL https://get.otfabric.io/opcuactl | sh

Binaries for Linux (x86-64, ARM64, ARMv7), macOS (Intel, Apple silicon) and Windows (x86-64, ARM64). The installer checks the release's SHA-256 checksum, installs per user without sudo (~/.local/bin, on Windows %LOCALAPPDATA%\OTFabric\bin) and upgrades in place when you run it again. Pin a version with OTF_VERSION; the CI line installs into a fixed directory without touching PATH or shell profiles. All installer options, release archives for offline machines. Check the install with opcuactl version.

opcuactl
├── discover servers | lds | endpoints
├── browse children | refs | tree | path
├── find namespace | node | type
├── get value | node | attr | vars | server
├── write value
├── call method
├── monitor value | event | alarm
├── alarms list | ack | confirm | comment | enable | disable | shelve | unshelve
│ suppress | unsuppress | remove-from-service | place-in-service
│ silence | reset | respond | groups | metrics | watch | audit
├── diagnostics summary | sessions | subscriptions | sampling | enable | disable
├── gds props | trustlist | groups | certs | csr | update-cert | self-signed
│ │ delete-cert | reset | transaction | rejected | apply | cancel
│ └── pull find | get | query | query-servers | register | update | unregister
│ request | finish | wait | trustlist | groups | certs | status
│ revoke | check-revocation | enroll
├── history value | event | update-events | delete-events
├── export nodes | values
├── pubsub subscribe | publish | call | respond | discover | decode
│ ├── sks get-keys
│ └── config show | add-* | remove | enable | disable | diagnostics
│ export | reserve-ids | add-action
├── serve
├── ping
├── version
└── completion

Every networked command takes the same connection flags. Settings can also come from OPCUACTL_* environment variables, which apply when the flag is not given.

Flag Environment variable Purpose
-e, --endpoint OPCUACTL_ENDPOINT Server endpoint: opc.tcp://host:4840, opc.wss://host:port or opc.https://host:port
--transport OPCUACTL_TRANSPORT tcp, wss, https, wss-uajson, https-uajson or a transport profile URI; the URL scheme alone means UA Binary
--json-content-type OPCUACTL_JSON_CONTENT_TYPE https-uajson Content-Type: standard (application/json, default) or legacy (application/opcua+uajson, which UA-.NETStandard 2.0.1 needs)
--security-policy OPCUACTL_SECURITY_POLICY None, Basic256Sha256, ECC_nistP256, …, or auto
--security-mode OPCUACTL_SECURITY_MODE None, Sign, SignAndEncrypt or auto
--auth OPCUACTL_AUTH anonymous, username, certificate, issued
--username, --password OPCUACTL_USERNAME, OPCUACTL_PASSWORD Username token
--token, --token-file OPCUACTL_TOKEN, OPCUACTL_TOKEN_FILE Issued token (raw or base64)
--auth-policy-id OPCUACTL_AUTH_POLICY_ID User token PolicyId (normally filled in by auto)
--cert, --key OPCUACTL_CERT, OPCUACTL_KEY Client certificate (RSA, ECDSA including Brainpool, Ed25519 or Ed448) and key
--server-cert OPCUACTL_SERVER_CERT Server certificate; skips the endpoint lookup for an explicit policy
--trusted-cert OPCUACTL_TRUSTED_CERT The trust list: CA or self-signed certificates the server’s certificate is checked against (repeatable; env is comma-separated). The system CA pool is not used
--insecure-no-security OPCUACTL_INSECURE_NO_SECURITY Allow an opc.tcp connection without message security (policy and mode None); refused without it
--insecure-skip-verify none Skip server certificate verification (insecure)
--tls-ca OPCUACTL_TLS_CA opc.wss and opc.https: roots for the server’s TLS certificate (default: system roots)
--tls-cert, --tls-key OPCUACTL_TLS_CERT, OPCUACTL_TLS_KEY opc.wss and opc.https: client TLS certificate for mutual TLS
--tls-insecure-skip-verify OPCUACTL_TLS_INSECURE_SKIP_VERIFY Skip the TLS certificate check (development only; warns)
--return-diagnostics OPCUACTL_RETURN_DIAGNOSTICS Ask for DiagnosticInfos (none, service, operation, all) and print them on failures
--reverse-listen OPCUACTL_REVERSE_LISTEN Listen on host:port and wait for the server to connect
--reverse-server-uri OPCUACTL_REVERSE_SERVER_URI Accept only the server announcing this ApplicationUri
--timeout OPCUACTL_TIMEOUT Dial, request and connect timeout; reverse connect wait (default 10s)
--namespace OPCUACTL_NAMESPACE Default namespace index for node IDs

NodeIDs use the standard forms i=2258, "ns=2;i=1001", "ns=2;s=Temperature", GUID (g=) and opaque (b=). Quote anything with a semicolon, or the shell splits the command. Well-known names such as CurrentTime, ServerStatus and Server also work as -n values.

opcuactl has the same client security options as go-opcua.

Concern How to set it
Transport The scheme of --endpoint: opc.tcp, opc.wss or opc.https; TLS with --tls-ca, --tls-cert, --tls-key
Channel protection --security-policy and --security-mode, or auto for both. No message security over opc.tcp needs --insecure-no-security; discover, opc.wss and opc.https need no opt-in
Client application certificate --cert and --key (required for Sign and SignAndEncrypt)
Trusting the server --trusted-cert (repeatable), the only trust list, or --insecure-skip-verify for development only. A secured channel needs one of them, and a server that presents no certificate is refused
User identity --auth anonymous|username|certificate|issued

The key type of --cert decides which policies you can use. auto, and discover endpoints --best --cert ..., only consider endpoints that fit the certificate: a server that offers both gets an ECC channel from a client with an ECC certificate and an RSA channel otherwise. auto also fills in the remote certificate and the user token PolicyId from the endpoint. With an explicit secure policy, opcuactl looks up the server certificate from the matching endpoint (one GetEndpoints round trip) unless you pass --server-cert.

  1. See what the server offers.

    Terminal window
    opcuactl discover endpoints -e opc.tcp://host:4840 --best -v
  2. Connect with auto-selection, a client certificate and a trusted CA.

    Terminal window
    opcuactl get value -e opc.tcp://host:4840 -n i=2258 \
    --auth username --username operator --password "$OPCUACTL_PASSWORD" \
    --security-policy auto --security-mode auto \
    --cert client.pem --key client.key \
    --trusted-cert server-ca.pem
  3. If the server rejects your certificate, move it from the server’s rejected store to its trusted store, and check its ApplicationUri and validity.

Other identities, from the README:

Terminal window
# ECC: an ECDSA P-256 certificate over an authenticated-encryption policy
opcuactl get value -e opc.tcp://host:4840 -n i=2258 \
--security-policy ECC_nistP256_AesGcm --security-mode SignAndEncrypt \
--cert client-ecc.pem --key client-ecc.key \
--trusted-cert server-ca.pem
# X.509 user identity (same certificate for channel and user token)
opcuactl get value -e opc.tcp://host:4840 -n i=2258 \
--auth certificate --cert client.pem --key client.key \
--security-policy auto --security-mode auto \
--trusted-cert server-ca.pem
# Issued token (JWT, SAML or opaque, depending on the server policy)
opcuactl get value -e opc.tcp://host:4840 -n i=2258 \
--auth issued --token-file ./token.jwt \
--security-policy auto --security-mode auto \
--cert client.pem --key client.key \
--trusted-cert server-ca.pem

Keep secrets in environment variables rather than flags: command-line arguments can appear in process listings and shell history. Keep private keys at chmod 600. Never send a username over a None/None channel. A BadSecurityPolicyRejected or “no endpoint” error with an ECC policy usually means the key type does not fit: ECC_nistP256* needs ECDSA P-256, ECC_nistP384 P-384 (or P-256), ECC_brainpoolP256r1 and ECC_brainpoolP384r1 an ECDSA key on a Brainpool curve, ECC_curve25519 Ed25519 and ECC_curve448 Ed448. An opaque BadIdentityToken error is often fixed by auto, which takes the right PolicyId from the endpoint.

HTTPS and WebSocket. -e opc.wss://... runs the secure channel inside a TLS WebSocket and -e opc.https://... sends each request as an HTTPS POST; every command works over both, subscriptions included. The TLS certificate is checked against --tls-ca and the host name, separately from the application certificates of --cert and --trusted-cert. discover endpoints shows a TRANSPORT column, and auto chooses among the endpoints of the transport you dialed.

Terminal window
opcuactl discover endpoints -e opc.wss://plc.example:4843 --tls-ca ./pki/tls-ca.pem
opcuactl get value -e opc.https://plc.example:4443 -n i=2258 --tls-ca ./pki/tls-ca.pem \
--auth username --username operator --password "$OPCUACTL_PASSWORD"

Reverse connect. Configure the server with the address opcuactl listens on, then add --reverse-listen to any command. --endpoint becomes optional. The ReverseHello is not authenticated, so use a secure mode and validate the server certificate on untrusted networks.

Terminal window
opcuactl get value --reverse-listen 0.0.0.0:4841 --timeout 60s -n i=2258 \
--reverse-server-uri urn:plant1:plc7 \
--security-policy Basic256Sha256 --security-mode SignAndEncrypt \
--cert client.pem --key client.key --trusted-cert plc7.pem

Start read-only. For an unknown server:

Terminal window
CONN=(-e opc.tcp://your-server:4840 --auth anonymous --security-mode None --security-policy None --insecure-no-security)
opcuactl ping "${CONN[@]}" -v # TCP, secure channel + session, browse
opcuactl discover endpoints "${CONN[@]}" --best
opcuactl get server "${CONN[@]}"
opcuactl find namespace "${CONN[@]}"
opcuactl browse tree "${CONN[@]}" --depth 2

Find and read a variable:

Terminal window
opcuactl find node "${CONN[@]}" --display-name Temperature
opcuactl browse path "${CONN[@]}" --path Server.ServerStatus
opcuactl get value "${CONN[@]}" -n "ns=2;s=Temperature" --timestamps
opcuactl get value "${CONN[@]}" -n "ns=2;s=ArrayNode" --index-range "0:2"
opcuactl get node "${CONN[@]}" -n "ns=2;s=Temperature" --full
opcuactl get vars "${CONN[@]}" -n "ns=3;s=PLC" --recursive --paths

Monitor changes and events:

Terminal window
opcuactl monitor value "${CONN[@]}" -n "ns=2;s=Temperature" \
--interval 1s --sampling 100ms --queue-size 10 --jsonl --duration 60s
opcuactl monitor value "${CONN[@]}" -n "ns=2;s=Temperature" \
--deadband-type absolute --deadband 0.5
opcuactl monitor event "${CONN[@]}" -n i=2253 \
--of-type i=2041 --severity-min 500 --severity-max 1000 \
--select EventType --select Message --select Severity

--interval is the publishing interval (default 100ms), --sampling the server’s sampling interval, --queue-size (default 10) and --discard-oldest the queue. --trigger status|status-value|status-value-timestamp and --deadband-type none|absolute|percent set a DataChangeFilter; a percent deadband needs an EURange property. --count stops after N samples. Queue overflow shows as [OVERFLOW] in tables and "overflow": true in JSON.

History and export:

Terminal window
opcuactl history value "${CONN[@]}" -n "ns=2;s=Temperature" \
--start 2026-03-10T00:00:00Z --end 2026-03-11T00:00:00Z \
--mode processed --interval 1h --aggregate average
opcuactl export values "${CONN[@]}" --start-node "ns=2;i=1" --depth 2 \
-f csv --output subtree-values.csv

History modes are raw (default), modified, processed and attime (repeatable --at); --aggregate accepts average, min, max and count.

Historical events are read from an event notifier, with the same fields and filters as monitor event:

Terminal window
# Alarms of Severity 500 and more, newest first (start after end), in pages of 100
opcuactl history event "${CONN[@]}" -n "ns=1;s=Demo" \
--start 2026-03-11T00:00:00Z --end 2026-03-10T00:00:00Z \
--of-type AlarmConditionType --severity-min 500 \
--select EventId --select Time --select ConditionId --select ActiveState/Id --num-values 100
# The last 10 events before a time
opcuactl history event "${CONN[@]}" -n "ns=1;s=Demo" --end 2026-03-11T00:00:00Z --max-events 10
# Insert an event, correct it, delete it (the notifier needs HistoryWrite)
opcuactl history update-events "${CONN[@]}" -n "ns=1;s=Demo" --yes \
--event '{"EventId":"0x0a01","Time":"2026-03-10T08:00:00Z","Message":"shift handover","Severity":100}'
opcuactl history update-events "${CONN[@]}" -n "ns=1;s=Demo" --yes --mode replace \
--event '{"EventId":"0x0a01","Message":"shift handover, line 2","Severity":200}'
opcuactl history delete-events "${CONN[@]}" -n "ns=1;s=Demo" --event-id 0x0a01 --yes

--select takes browse paths (AckedState/Id, 2:Temperature) and ConditionId. --num-values is the page size: opcuactl follows the continuation points until the range is read or --max-events events came back, and releases the point it leaves. update-events takes events as JSON (--event, or --events-file, - for stdin) with --mode insert|replace|update; like write value, both commands ask before changing anything (--yes, --dry-run).

alarms list calls ConditionRefresh and shows the retained conditions with their states and the EventId of their latest event. The other commands call the Part 9 methods on a condition and look up that EventId for you.

Terminal window
opcuactl alarms list "${CONN[@]}" --state unacked --severity-min 500 -v
opcuactl alarms ack "${CONN[@]}" "ns=2;s=Tank.LevelAlarm" -m "checking the level sensor"
opcuactl alarms confirm "${CONN[@]}" "ns=2;s=Tank.LevelAlarm" -m "sensor replaced"
opcuactl alarms shelve "${CONN[@]}" "ns=2;s=Tank.LevelAlarm" --for 8h -m "sensor on order"
opcuactl alarms remove-from-service "${CONN[@]}" "ns=2;s=Pump3.Overload" -m "pump 3 in repair"
opcuactl alarms watch "${CONN[@]}" --jsonl

--event-id acknowledges a specific event and --branch a condition branch. suppress, silence, reset (latched alarms), respond (dialogs), groups and metrics get|reset cover OPC UA 1.05; with -m the commands that have a ...2 variant call it with the comment. alarms audit streams the audit events of the condition methods, and --audit-entry-id tags your own requests. A refused method exits with 6 (9 when the user may not call it) and says why.

Terminal window
opcuactl diagnostics summary "${CONN[@]}"
opcuactl diagnostics sessions "${CONN[@]}" --session self
opcuactl diagnostics subscriptions "${CONN[@]}"
opcuactl get value "${CONN[@]}" -n "ns=2;s=Missing" --return-diagnostics all

Reading another session’s details, the security diagnostics, and diagnostics enable|disable usually need an administrator. --return-diagnostics prints the server’s DiagnosticInfos for failed requests on stderr, so the normal output stays unchanged.

The gds commands manage a server’s certificates by the push model of Part 12. They need a SecurityAdmin session over SignAndEncrypt:

Terminal window
SEC=(-e opc.tcp://plc:4840 --security-policy Basic256Sha256 --security-mode SignAndEncrypt
--cert client.pem --key client.key --trusted-cert plc-ca.pem
--auth username --username secadmin --password "$P")
opcuactl gds trustlist get "${SEC[@]}" --out ./plc-pki
opcuactl gds rejected "${SEC[@]}" --out ./rejected
opcuactl gds trustlist add "${SEC[@]}" ./rejected/3F2A...C01B.der
# Renew the server certificate through your CA
opcuactl gds csr "${SEC[@]}" --type rsa --regenerate --out plc.csr
opcuactl gds update-cert "${SEC[@]}" plc.pem --issuer ca.pem --yes

--group https|usertoken|<NodeId> works on the HTTPS and user token certificate groups. gds self-signed, delete-cert, reset and transaction cover the rest of Part 12 1.05; changes are applied in the same session unless you pass --no-apply.

gds pull works with a Global Discovery Server instead. enroll registers or finds the application, requests a certificate, waits for approval and writes the certificate, the private key (mode 0600) and the trust list:

Terminal window
GDS=(-e opc.tcp://gds:58810 --security-policy Basic256Sha256 --security-mode SignAndEncrypt
--cert client.pem --key client.key --trusted-cert gds.pem
--auth username --username gdsadmin --password "$P")
opcuactl gds pull enroll "${GDS[@]}" --uri urn:plant:line4 --name "Line 4" --type client \
--new-key ecc-p256 --cert-type ecc-p256 --cert-out line4.pem --trust-out ./pki
opcuactl gds pull check-revocation "${GDS[@]}" line4.pem # exit 1 when not Good

register, query, request, finish, wait, trustlist, status and revoke do the same exchange step by step.

The pubsub commands listen to, publish and configure OPC UA PubSub over UDP, Ethernet, MQTT and AMQP, with UADP or JSON:

Terminal window
# Print the DataSets on a UDP multicast group
opcuactl pubsub subscribe --url opc.udp://224.0.0.22:4840
# Name the fields: UADP carries no names
opcuactl pubsub subscribe --url opc.udp://224.0.0.22:4840 --field Temperature:Double --field Time:DateTime
# JSON (or UADP) through an MQTT broker; announced ua-metadata is used automatically
opcuactl pubsub subscribe --url mqtt://broker:1883 --topic 'plant/#' --show-metadata
# Secured UADP: keys of SecurityGroup sg1 from the Security Key Service
opcuactl pubsub subscribe --url opc.udp://224.0.0.22:4840 --security-group sg1 --message-security sign-and-encrypt \
-e opc.tcp://sks:4840 --security-policy Basic256Sha256 --security-mode SignAndEncrypt \
--cert client.pem --key client.key --auth username --username subscriber --password "$OPCUACTL_PASSWORD"
# Publish a test DataSet: 10 messages, one every 500 ms
opcuactl pubsub publish --url opc.udp://224.0.0.22:4840 --publisher-id 2234 --writer-group-id 100 --writer-id 1 \
--field Counter:UInt32=42 --field Temp:Double=21.5 --count 10 --interval 500ms
# Configure a server's PublishSubscribe object
opcuactl pubsub config show -e opc.tcp://localhost:4840

publish sends test DataSets, discover probes for publishers, call and respond exercise PubSub Actions, decode decodes captures, sks get-keys fetches keys, and config adds, removes, enables and reads the diagnostics of a server’s connections, groups, writers and readers. The PubSub page explains the model and the options.

Terminal window
# Validate only
opcuactl write value "${CONN[@]}" -n "ns=2;s=Setpoint" --value 42.5 --type double --dry-run
# Write with a confirmation prompt, then verify
opcuactl write value "${CONN[@]}" -n "ns=2;s=Setpoint" --value 42.5 --type double
opcuactl get value "${CONN[@]}" -n "ns=2;s=Setpoint"

--type accepts bool, int16, uint16, int32, uint32, int64, uint64, float, double, string, bytes (base64), datetime, guid, nodeid, json, and ua-json or ua-xml for any data type as an OPC UA JSON or XML Variant. --yes skips the prompt for scripts.

Inspect a method before calling it:

Terminal window
opcuactl call method "${CONN[@]}" --object "ns=2;i=1" --method "ns=2;i=2" --introspect
opcuactl call method "${CONN[@]}" --object "ns=2;i=1" --method "ns=2;i=2" \
--arg 42 --arg hello --types int32,string

-f, --format selects table (default), json, yaml, csv or jsonl; --pretty indents JSON and YAML; -q, --quiet prints only the primary value; -v writes diagnostics to stderr. Data goes to stdout and errors to stderr. get value --ua-encoding json|json-verbose|json-reversible|json-nonreversible|xml prints the DataValue in the OPC UA Part 6 encoding for exchange with other stacks.

Code Meaning
0 Success
1 gds pull check-revocation: the certificate is not valid
2 Usage or validation error
3 Input file that cannot be read
4 Connection or transport failure, also a connection lost during a service, monitor or alarms watch
5 Timeout
6 OPC UA service or status-code failure
7 Partial success (batch and export operations, history update-events and delete-events with some failed events)
8 Service not supported by the server
9 Permission: Bad_UserAccessDenied, or the operating system refused
130 Interrupted by Ctrl+C or SIGTERM before a result

The codes follow the OT Fabric CLI exit-code table since v0.11.0; docs/exitcodes.md maps the older ones. monitor value exits with code 6 when the server rejected every monitored item; rejected items are reported on stderr while the others keep running. A Bad status from the server exits 6 for write value, call method and the history commands, as does a node that does not exist for get node, browse and find. ping exits 4 when the server cannot be reached and 6 when it cannot be browsed, so it works as a health check in scripts and CI. monitor and alarms watch do not reconnect: a lost connection ends them with exit 4 after printing what arrived. OPCUACTL_FORMAT sets the default of --format.

opcuactl serve runs an OPC UA server built on go-opcua: to try the commands without a PLC, to give a CI job a server, or to test another client against a known one. It runs until Ctrl+C or SIGTERM (or --duration), then closes its sessions and exits.

Terminal window
# Port 4840 with None and Basic256Sha256 endpoints; save the self-signed certificate it makes
opcuactl serve --insecure-no-security --cert-out server.pem --key-out server.key --user operator:secret
# In another terminal: the demo namespace is ns=1
export OPCUACTL_INSECURE_NO_SECURITY=true
opcuactl get value -e opc.tcp://localhost:4840 -n "ns=1;s=Demo.Counter"
opcuactl write value -e opc.tcp://localhost:4840 -n "ns=1;s=Demo.Level" --value 90 --type double --yes
opcuactl alarms list -e opc.tcp://localhost:4840
opcuactl history event -e opc.tcp://localhost:4840 -n "ns=1;s=Demo" --max-events 10 --end 2030-01-01T00:00:00Z
# opc.wss and opc.https next to opc.tcp, with their UA JSON mappings
opcuactl serve --wss 0.0.0.0:4843 --https 0.0.0.0:4443 --uajson --cert-out server.pem
opcuactl get value -e opc.wss://localhost:4843 --transport wss-uajson --tls-ca server.pem -n "ns=1;s=Demo.Sine"
# Your own information model instead of the demo, for trusted clients only
opcuactl serve --cert server.pem --key server.key --trust-dir ./pki/trusted --no-demo --nodeset machine.NodeSet2.xml
# For scripts: just the endpoint URLs, on a free port
opcuactl serve --listen 127.0.0.1:0 -q
Demo node (ns=1) What it does
Demo.Boolean, Demo.Int32, Demo.Double, Demo.String, Demo.DateTime, Demo.Int32Array Read-only values of the common types
Demo.Counter Counts up every --sim-interval (default 1 s), for subscriptions
Demo.Sine A sine wave between -1 and 1, historized for history value
Demo.Level A writable Double, starting at 50
Demo.LevelAlarm An exclusive level alarm on Demo.Level: High at 80, HighHigh at 95, to acknowledge and shelve with alarms
Demo.Add A method of Demo: Add(a, b Int32) returns the sum

Demo is also an event notifier with an event history of its last 1000 events (the start event and the alarm transitions), writable for history update-events and delete-events. --security-policy offers any policy of the client (default Basic256Sha256; --insecure-no-security adds None, and --security-policy None needs it); every policy without a --cert gets a self-signed certificate at start (RSA, ECDSA P-256 and P-384, Ed25519). --trusted-cert and --trust-dir restrict the clients, and --user name:password adds users next to anonymous access (--allow-anonymous=false turns that off; an anonymous client then gets BadIdentityTokenRejected, and a user name over an unsecured channel is refused). --log-clients prints a line on stderr for every connection, session and refused request. The server allows 100 sessions, 1024 subscriptions in all and 64 per session by default (--max-sessions, --max-subscriptions and --max-subscriptions-per-session change them, and it publishes them in its ServerCapabilities), and clients can write attributes other than Value only where a node’s WriteMask allows it.

For PubSub, opcuactl plays both sides itself: pubsub publish feeds a subscriber with test data and pubsub respond is a test Responder for Actions. The opcua-interop reference servers are the next step, to test against other stacks.