Monitor
The OPC UA Monitor node enables real-time monitoring of variables on an OPC UA server. Unlike the Read node which retrieves values on demand, the Monitor node establishes subscriptions that automatically notify you when values change, making it ideal for continuous monitoring and alarm systems.
Overview
The Monitor node uses the OPC UA subscription mechanism to efficiently track data changes. You configure monitoring parameters once, and the node automatically sends messages whenever monitored values change, without requiring repeated polling.
Key Features:
- Automatic Notifications: Receive updates when values change
- Multiple Monitoring Modes: Single variables, arrays, JSON structures, or entire subtrees
- Deadband Filtering: Reduce notifications by filtering insignificant changes
- Efficient Subscriptions: Multiple monitored items share the same subscription
- Flexible Configuration: Static or dynamic NodeId specification
Tutorials
Getting Started
- Monitoring a Single Variable - Configure and monitor a single OPC UA variable with static NodeId
- Monitoring with Injected NodeId - Dynamically specify which variable to monitor at runtime
Advanced Monitoring
- Monitoring Multiple Variables (Array) - Monitor multiple variables simultaneously using arrays
- Monitoring JSON Structures - Use named properties for better organization and readability
- Monitoring an OPC UA Subtree - Automatically monitor entire branches of the address space
Optimization
- Deadband Filtering - Reduce notification frequency by filtering insignificant value changes
Quick Start
Basic Example - Monitor a Temperature Sensor:
- Add a Monitor node to your flow
- Configure the OPC UA endpoint
- Select a subscription
- Enter the NodeId (e.g.,
ns=1;s=Temperature) - Check "Start Immediately"
- Deploy your flow
The node will automatically send messages when the temperature changes.
Monitoring Concepts
Subscriptions
Subscriptions are configured in the OPC UA endpoint and define:
- Publishing Interval: How often the server sends notification batches
- Lifetime: How long the subscription remains active
- Priority: Relative importance for resource allocation
A single subscription can efficiently handle many monitored items.
Monitored Items
Each monitored item tracks a specific variable and has its own:
- Sampling Interval: How often the server checks the value
- Queue Size: How many notifications to buffer
- Filter: Deadband or other filtering criteria
Notification Behavior
The OPC UA server only sends notifications when:
- The value actually changes (per OPC UA specification)
- The change exceeds the deadband threshold (if configured)
- An initial value when monitoring starts
Use Cases
Process Monitoring
Monitor critical process variables in real-time:
// Temperature, pressure, flow rate
["ns=1;s=Reactor.Temperature", "ns=1;s=Reactor.Pressure", "ns=1;s=Reactor.FlowRate"]
Equipment Status
Track equipment operational status:
{
"running": "ns=1;s=Pump1.Running",
"speed": "ns=1;s=Pump1.Speed",
"hours": "ns=1;s=Pump1.OperatingHours"
}
Alarm Detection
Monitor for alarm conditions:
// Check multiple sensors for threshold violations
if (msg.payload > 80) {
node.send({ payload: "High temperature alarm" });
}
Historical Logging
Log all value changes to a database:
// Each notification triggers a database insert
msg.topic = "INSERT INTO history VALUES (?, ?, ?)";
Configuration Parameters
Common Settings
| Parameter | Description | Default |
|---|---|---|
| Start Immediately | Begin monitoring when flow starts | Unchecked |
| NodeId | Variable to monitor (if Start Immediately is checked) | Empty |
| Sample Interval | Server sampling rate in milliseconds | 1000 |
| Queue Size | Maximum buffered notifications | 1000 |
| Discard Oldest | Remove oldest when queue is full | True |
Advanced Settings
| Parameter | Description | Options |
|---|---|---|
| Deadband Type | Change filtering method | None, Absolute, Percent |
| Deadband Value | Threshold for notifications | Numeric |
| Output Type | Message format | Value, DataValue |
Message Properties
Input Properties
Override node configuration via message properties:
{
"topic": "ns=1;s=Temperature",
"samplingInterval": 500,
"queueSize": 100,
"deadbandType": "Absolute",
"deadbandValue": 0.5,
"outputType": "DataValue"
}
Output Properties
Standard output message format:
{
"topic": "ns=1;s=Temperature",
"payload": 23.5,
"statusCode": {
"value": 0,
"description": "Good"
},
"sourceTimestamp": "2024-11-24T10:30:45.123Z",
"serverTimestamp": "2024-11-24T10:30:45.125Z"
}
Tips & Best Practices
Choose Appropriate Sampling Intervals
- Fast processes (< 100ms): Critical control loops
- Normal processes (100ms - 1s): Most monitoring applications
- Slow processes (> 1s): Temperature, level, batch processes
Use Deadband Filtering
Reduce notifications by 80-95% for analog values with natural fluctuations:
{
"deadbandType": "Absolute",
"deadbandValue": 0.5 // For temperature in °C
}
Organize Related Variables
Group related variables in JSON structures for better maintainability:
{
"process": {
"temperature": "ns=1;s=Temp",
"pressure": "ns=1;s=Press"
}
}
Handle Connection Issues
The Monitor node automatically reconnects and resumes monitoring after connection loss. No manual intervention required.
Monitor Resource Usage
For large numbers of monitored items:
- Monitor Node-RED memory usage
- Check network bandwidth
- Review notification frequency
- Consider splitting across multiple Monitor nodes
Troubleshooting
No Notifications Received
- Verify endpoint connection (green indicator)
- Check subscription is active
- Validate NodeId using Read node
- Ensure "Start Immediately" is checked (or inject NodeId)
Too Many Notifications
- Implement deadband filtering
- Increase sampling interval
- Check for server-side noise
- Verify appropriate variable selection
Missing Some Notifications
- Increase queue size
- Verify "Discard Oldest" setting
- Check network stability
- Review Node-RED processing speed
Memory Issues
- Reduce number of monitored items
- Increase sampling intervals
- Implement filtering
- Split into multiple Monitor nodes
Related Sections
- Connection - Configure OPC UA server connections
- Read - Read values on demand
- Explore - Discover address space structure
- Monitor Events - Monitor OPC UA events