Plugins 〉Simple OPC-UA


Developer

monyskow

Sign up to receive occasional product news and updates:



Data Source
community

Simple OPC-UA

  • Overview
  • Installation
  • Change log
  • Related content

Simple OPC-UA Data Source for Grafana

A Grafana data source plugin for connecting to OPC-UA servers. Read industrial data directly in Grafana dashboards.

Features

  • Easy Configuration: Simple setup with endpoint URL, security settings, and authentication
  • Multiple Auth Methods: Anonymous, Username/Password, and Certificate authentication
  • Node Browser: Graphical tree browser for exploring OPC-UA address space
  • Template Variables: Full support for Grafana template variables in Node IDs
  • Health Checks: Built-in connection testing via Save & Test

Requirements

  • Grafana 10.4.0 or later
  • Access to an OPC-UA server

Installation

From Grafana Plugin Catalog

  1. In Grafana, go to Configuration > Plugins
  2. Search for "Simple OPC-UA"
  3. Click Install

Manual Installation

  1. Download the latest release from GitHub Releases
  2. Extract to your Grafana plugins directory (usually /var/lib/grafana/plugins)
  3. Restart Grafana

Configuration

Connection Settings

SettingDescriptionExample
Endpoint URLOPC-UA server endpointopc.tcp://localhost:4840
Security PolicyEncryption algorithmNone, Basic256Sha256
Security ModeMessage securityNone, Sign, SignAndEncrypt
TimeoutConnection timeout (seconds)10

Security

When using security modes other than "None" (Sign or SignAndEncrypt), the plugin provides two options:

Option 1: Auto-Generated Certificate (Recommended)

The plugin can automatically generate and manage client certificates:

  1. Click "Generate Certificate" button in the datasource configuration
  2. The plugin generates a self-signed client certificate
  3. Click "Save & Test" to persist the certificate
  4. The certificate is securely stored in Grafana's encrypted storage

The auto-generated certificate is valid for 3 years and persists across Grafana restarts.

Option 2: Provide Your Own Certificate

For advanced use cases, you can provide your own client certificate using the Certificate authentication method (see Authentication section below).

Important: For secure connections, you must either generate a certificate or provide your own. The OPC-UA server must trust the client certificate - consult your OPC-UA server documentation for adding trusted certificates.

Supported Security Policies:

  • None (no encryption)
  • Basic256Sha256
  • Aes128_Sha256_RsaOaep
  • Aes256_Sha256_RsaPss

Supported Security Modes:

  • None
  • Sign (messages are signed but not encrypted)
  • SignAndEncrypt (messages are signed and encrypted)

Authentication

Anonymous

No credentials required. Select "Anonymous" as the authentication method.

Username/Password

  1. Select "Username / Password" as the authentication method
  2. Enter your username and password
  3. Credentials are stored securely using Grafana's secure JSON data

Certificate

For advanced use cases where you need to use a specific client certificate:

  1. Select "Certificate" as the authentication method
  2. Paste your PEM-encoded certificate and private key
  3. Both are stored securely using Grafana's secure JSON data

Note: When using Certificate authentication, the provided certificate is used instead of the auto-generated one.

Usage

Building Queries

  1. Add a new panel and select the OPC-UA data source
  2. Click "Browse Nodes" to explore the OPC-UA address space
  3. Click the + icon next to any Variable node to add it to your query
  4. Optionally, set an alias for each node

Using Template Variables

You can use Grafana template variables in Node IDs:

ns=2;s=${machine}/Temperature

Development

Prerequisites

  • Node.js 22+
  • Go 1.22+
  • Docker (for testing)

Quick Start

# Install and build
npm install
npm run build
mage buildAll

Start development environment (choose one):

1. Basic - Grafana + plugin (no provisioning)

docker compose up

2. Full - Complete test environment with OPC-UA simulators

docker compose -f docker-compose.full.yaml up

3. ProSys - For ProSys OPC-UA Simulator testing (requires ProSys on host)

docker compose -f docker-compose.prosys.yaml up

Open http://localhost:3000 (or :3001 for ProSys)

Docker Compose Configurations:

ConfigurationDatasourcesDashboardsOPC-UA ServersPortUse Case
docker-compose.yamlNoneNoneNone3000Manual testing, clean slate
docker-compose.e2e.yaml1 (test)NoneNone3000E2E tests (used by npm run e2e)
docker-compose.full.yaml14 (docker-based)Yes5 containers3000Complete integration testing
docker-compose.prosys.yaml14 (ProSys)YesProSys on host3001ProSys simulator testing

OPC-UA Test Servers

For development and testing, you can use OPC-UA simulators:

Docker-based Simulators (Included)

The docker-compose.full.yaml setup includes 5 containerized OPC-UA test servers using Microsoft OPC-PLC and node-opcua. These servers are provided solely for testing convenience and are not part of the plugin itself.

Available servers:

  • opcua-nosecurity (port 50000) - No security, anonymous only
  • opcua-secure-anon (port 50001) - Security enabled, anonymous auth
  • opcua-secure-userpass (port 50002) - Security enabled, username/password (user1/password1)
  • opcua-all-auth (port 50003) - All authentication methods enabled
  • opcua-node (port 4840) - Node-OPCUA server with Aes256_Sha256_RsaPss support

ProSys OPC-UA Simulator (External)

ProSys OPC-UA Simulation Server is a third-party external tool that can be used for testing. It is not included with this plugin.

To test with ProSys:

  1. Download and install ProSys OPC-UA Simulation Server on your host machine
  2. Start the ProSys simulator
  3. Use docker compose -f docker-compose.prosys.yaml up to run Grafana configured to connect to ProSys via host.docker.internal

Note: ProSys is a separate commercial product with its own licensing. See the ProSys website for details.

Additional Commands

# Linting and validation
npm run lint               # ESLint
npm run lint:fix           # Auto-fix + Prettier
npm run typecheck          # TypeScript check

Development mode

npm run dev # Frontend watch mode

Testing

# Unit tests
npm run test:ci              # Frontend
mage test                    # Backend

E2E tests (against multiple Grafana versions)

npm run e2e # Run all tests npx playwright test –ui # Interactive mode

Test specific Grafana version

GRAFANA_VERSION=10.4.0 npm run server

Architecture

Frontend (src/):

  • module.ts - Plugin entry point
  • datasource.ts - OpcuaDataSource (extends DataSourceWithBackend)
  • components/ConfigEditor/ - Data source configuration UI
  • components/QueryEditor/ - Query editor with node browser

Backend (pkg/):

  • plugin/datasource.go - Query and health check handlers
  • plugin/resources.go - HTTP handlers for /browse and /endpoints
  • plugin/opcua/ - OPC-UA client, auth, browsing, certificates

Key Dependencies:

  • Go: github.com/gopcua/opcua - OPC-UA protocol
  • Go: github.com/grafana/grafana-plugin-sdk-go - Plugin SDK

License

Apache License 2.0. See LICENSE for details.

Support

Installing Simple OPC-UA on Grafana Cloud:

For more information, visit the docs on plugin installation.

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

Added

  • Certificate generation UI with "Generate Certificate" button for secure connections
  • Client certificates are now stored in Grafana's encrypted storage (secureJsonData)
  • Certificates persist across Grafana restarts and datasource updates
  • Certificate status indicator showing configured/not configured state
  • Support for Sign and SignAndEncrypt security modes with auto-generated certificates
  • GitHub Sponsors link for plugin support

Changed

  • Security modes now support certificate auto-generation from the UI
  • Certificates are automatically cached during the plugin session for performance
  • Certificate lifecycle management - valid for 3 years with automatic renewal when expiring soon

[1.0.0] - 2024-12-25

Added

  • Initial release
  • OPC-UA Data Access (DA) support
  • Node browsing with tree view
  • Anonymous authentication
  • Username/Password authentication
  • Certificate authentication
  • Security policy and mode configuration
  • Connection timeout configuration
  • Template variable support
  • Health check implementation