Skip to content

A collector for logging OPCUA data to InfluxDB (and possibly other later).

License

Notifications You must be signed in to change notification settings

Maddin-619/node-opcua-logger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-opcua-logger

A logger for logging OPCUA data to InfluxDB (and possibly other later). Has been running in production in several factories since mid 2016.

This application will connect to an OPC UA server, subscribe to the measurements in your configuration and log them to an influxdb instance. It first buffers the data in a local db, so that in case influxdb is temporarily unavailable, your data is not lost.

Installation

Make sure you have a recent version of node installed (>4), then execute the following commands.

$ git clone https://github.com/coussej/node-opcua-logger.git
$ cd node-opcua-logger
$ npm install

Configuration

Modify the config.toml file to match your configuration. The input section should contain the url of the OPC server (no advanced authentication supported yet). For each input OPC server you can configure the following entries.

[[input]]
url             = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
failoverTimeout = 5000     # time to wait before reconnection in case of failure

Then, for each OPC value you want to log from this server, repeat the following in the config file:

# A polled node:
[[input.measurements]]
name               = "Int32polled"
tags               = { tag1 = "test", tag2 = "AB43" }
nodeId             = "ns=2;i=10849"
collectionType     = "polled"
pollRate           = 20     # samples / minute.
deadbandAbsolute   = 0      # Absolute max difference for a value not to be collected
deadbandRelative   = 0.0    # Relative max difference for a value not to be collected

# A monitored node
[[input.measurements]]
name               = "Int32monitored"
tags               = { tag1 = "test", tag2 = "AB43" }
nodeId             = "ns=2;i=10849"
collectionType     = "monitored"
monitorResolution  = 1000    # ms 

In the output section, specify the connection details for influxdb:

[output]
name             = "influx_1"
type             = "influxdb"
host             = "127.0.0.1"
port             = 8086
protocol         = "http"
username         = ""
password         = ""
database         = "test"
failoverTimeout  = 10000     # Time after which the logger will reconnect
bufferMaxSize    = 64        # Max size of the local db in MB. TODO.
writeInterval    = 3000      # Interval of batch writes.
writeMaxPoints   = 1000      # Max point per POST request.

Run

$ node logger.js

About

A collector for logging OPCUA data to InfluxDB (and possibly other later).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%