Skip to main content

Monitor Event

The OPC UA Monitor Event node enables real-time monitoring of events emitted by objects on an OPC UA server. Events represent discrete occurrences such as alarms, state changes, user actions, and system notifications.

Overview

Unlike variable monitoring which tracks continuous value changes, event monitoring captures specific occurrences like alarm activations, equipment state transitions, or audit events. Events carry structured information defined by their event type, including severity, message, timestamp, and type-specific fields.

Key Features:

  • Event Filtering: Use Where Clauses to select specific event types
  • Field Selection: Choose which event fields to receive
  • Alarm Monitoring: Track alarm conditions and states
  • Audit Logging: Monitor user actions and security events
  • System Events: Track server status and diagnostics

Tutorials

Quick Start

Basic Example - Monitor All Server Events:

  1. Add a Monitor Event node to your flow
  2. Configure the OPC UA endpoint
  3. Select a subscription
  4. Set NodeId to i=2253 (Server object)
  5. Leave Where Clause empty (all events)
  6. Set Select Clause to: EventId,Time,Message,Severity
  7. Deploy your flow

The node will send messages whenever events occur on the server.

Event Concepts

Event Types

OPC UA defines a hierarchy of event types:

  • BaseEventType: Root of all events
    • SystemEventType: System status events
    • AlarmConditionType: Alarms and conditions
      • LimitAlarmType: High/low limit alarms
      • DiscreteAlarmType: Binary state alarms
    • AuditEventType: Security and user actions

Event Fields

Common fields available in most events:

FieldDescription
EventIdUnique identifier for this event occurrence
EventTypeNodeId of the event type definition
SourceNameName of the object that generated the event
TimeWhen the event occurred
MessageHuman-readable description
SeverityImportance level (1-1000)

Where Clause

Filters which events are received:

// Only alarm events
ofType("AlarmConditionType")

// High severity events
Severity >= 700

// Specific source
SourceName = "Reactor1"

Select Clause

Specifies which fields to retrieve:

EventId,EventType,SourceName,Time,Message,Severity

Use the graphical selector (... button) to browse and select available fields.

Use Cases

Alarm Management

Monitor critical equipment alarms:

// Where Clause
ofType("AlarmConditionType") AND Severity >= 600

// Select Clause
EventId,Time,Message,Severity,ActiveState,AckedState,SourceName

Process alarms:

if (msg.payload.ActiveState && !msg.payload.AckedState) {
// Send notification for active, unacknowledged alarms
node.send(msg);
}

Audit Logging

Track user actions and security events:

// Where Clause
ofType("AuditEventType")

// Log to database
msg.topic = "INSERT INTO audit_log VALUES (?, ?, ?)";
msg.params = [msg.payload.Time, msg.payload.Message, msg.payload.SourceName];

System Monitoring

Monitor server health and status:

// Where Clause
ofType("SystemEventType")

// Alert on critical system events
if (msg.payload.Severity >= 800) {
msg.payload = "Critical system event: " + msg.payload.Message;
node.send(msg);
}

Event Dashboard

Create real-time event displays:

// Format for dashboard
const level = msg.payload.Severity >= 800 ? "critical" :
msg.payload.Severity >= 600 ? "warning" : "info";

msg.payload = {
level: level,
title: msg.payload.SourceName,
message: msg.payload.Message,
timestamp: new Date(msg.payload.Time)
};

Configuration Parameters

Common Settings

ParameterDescription
NameNode identifier in the flow
EndpointOPC UA server connection
SubscriptionSubscription for event monitoring
NodeIdObject that emits events (e.g., Server, equipment)
Where ClauseFilter expression for event types/properties
Select ClauseComma-separated list of fields to retrieve

Event Source Objects

Common NodeIds for event monitoring:

  • Server object: i=2253 (system-wide events)
  • Equipment objects: ns=2;s=Equipment.Reactor1
  • Folder objects: Aggregate events from children

Severity Levels

OPC UA standard severity ranges (0-1000):

RangeLevelDescription
1-200LowInformational events
201-400Low-MediumMinor issues
401-600MediumNoteworthy conditions
601-800Medium-HighImportant warnings
801-1000HighCritical alarms

Example filtering:

// Only high-priority events
Severity >= 600

Message Format

Standard output message:

{
"topic": "event",
"payload": {
"EventId": "4f3b2a1c...",
"EventType": "ns=0;i=2041",
"SourceName": "Reactor1",
"Time": "2024-11-24T10:30:45.123Z",
"Message": "Temperature exceeded limit",
"Severity": 800
}
}

For alarm events with additional fields:

{
"payload": {
"EventId": "4f3b2a1c...",
"Time": "2024-11-24T10:30:45.123Z",
"Message": "High temperature alarm",
"Severity": 850,
"SourceName": "Reactor1",
"ActiveState": true,
"AckedState": false,
"ConditionName": "HighTemperatureAlarm"
}
}

Tips & Best Practices

Filter at the Server

Use Where Clauses to filter events at the source rather than in Node-RED:

Efficient:

whereClause: "ofType('AlarmConditionType') AND Severity >= 700"

Inefficient:

whereClause: "" // Receive all events
// Filter in function node

Select Minimal Fields

Request only the fields you need to reduce message size and processing:

Good:

EventId,Time,Message,Severity

Excessive:

EventId,EventType,SourceNode,SourceName,Time,ReceiveTime,LocalTime,Message,Severity,...

Use the Graphical Selector

The easiest way to build Select Clauses:

  1. Click ... button next to Select Clause
  2. Browse the event type hierarchy
  3. Check desired fields
  4. Clause is auto-generated

Handle High-Frequency Events

Implement rate limiting or aggregation:

// Function node: Aggregate events
const events = context.get('events') || [];
events.push(msg.payload);

// Emit summary every 5 seconds
const lastEmit = context.get('lastEmit') || 0;
const now = Date.now();

if (now - lastEmit > 5000) {
msg.payload = {
count: events.length,
events: events
};
context.set('events', []);
context.set('lastEmit', now);
return msg;
}

return null;

Troubleshooting

No Events Received

  1. Verify server supports event monitoring
  2. Check NodeId points to event-generating object
  3. Try Server object (i=2253)
  4. Remove Where Clause to see all events
  5. Verify subscription is active

Too Many Events

  1. Add Where Clause to filter by type
  2. Filter by severity: Severity >= 600
  3. Monitor specific equipment instead of Server
  4. Implement rate limiting in Node-RED

Missing Event Fields

  1. Use graphical selector to see available fields
  2. Check event type documentation
  3. Some fields only exist for certain event types
  4. Start with basic fields

Event Delays

  1. Reduce subscription publishing interval
  2. Check network latency
  3. Verify server performance
  4. Review queue sizes

Resources