Code Monkey home page Code Monkey logo

node-opcua-logger's People

Contributors

coussej avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-opcua-logger's Issues

[WARN] buffer - MaxBatchSize Exceeded

Hi there,
thanks for sharing the script. it works perfect.
I am logging almost 2000 tags right now.

Question:
Why I am getting this warning? and how can i fix it?
[WARN] buffer - MaxBatchSize Exceeded { max: 1000 }

where are Environment variables?

cannot start the Win-64 service

Hello Sir,

I tried to run the Win-64 .exe service and it throws out an error pointing to
node-opcua-logger\node-modules\toml\lib\parser.js:3833 as shown in the capture.
image

Could you help check the error and share the solution?

Thanks,
Jason

Test on rpi.

Hi
Referring to my comment on this post: https://coussej.github.io/2019/10/28/Open-Source-Monitoring-of-Industrial-Systems-with-InfluxDB-using-OPC-UA-Part-2/

I have done the first tests on the Pi.
When i start with npm run start i get this in terminal

> [email protected] start /home/pi/node-opcua-logger
> node ./src/index.js

/home/pi/node-opcua-logger/node_modules/toml/lib/compiler.js:14
    for (var i = 0; i < nodes.length; i++) {
                              ^

TypeError: Cannot read property 'length' of undefined
    at reduce (/home/pi/node-opcua-logger/node_modules/toml/lib/compiler.js:14:31)
    at Object.compile (/home/pi/node-opcua-logger/node_modules/toml/lib/compiler.js:10:10)
    at Object.parse (/home/pi/node-opcua-logger/node_modules/toml/index.js:7:21)
    at Object.load (/home/pi/node-opcua-logger/src/config.js:14:17)
    at Object.<anonymous> (/home/pi/node-opcua-logger/src/index.js:8:19)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node ./src/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-02-05T19_14_10_342Z-debug.log

The debug log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/node-opcua-logger/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
9 verbose lifecycle [email protected]~start: CWD: /home/pi/node-opcua-logger
10 silly lifecycle [email protected]~start: Args: [ '-c', 'node ./src/index.js' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `node ./src/index.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/pi/node-opcua-logger
16 verbose Linux 4.19.66-v7+
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "start"
18 verbose node v10.18.1
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `node ./src/index.js`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Metrics Configuration

Is there any examples/documentation of Metrics configurations ?
I am having problems understanding this, in particular the nodeId.
Would you be able to provde the correct configutation details for this example simulation in KepEX
Do I need to create an Alias first ?

Random Number

Tag 1

bi-directional communication

What are the possibilities to also write data back to the OPC server? I don't think it's currently supported by node-opcua but does the underlying library node-opcua allows it? If so, we can investigate if it's worth it to work on a PR.

ANONYMOUS user token policy Error

Hi, I have been involved with PLCs and automation for many years, however I am very new to Nodejs, Git and have very limited linux experience.

I have managed to get the opc logger working in the demo mode succesfuly sending data to influx, however when I try to connect to OPC UA server I am unsuccesful.

OS: Windows 10 Pro 64 bit
Node v2.0.0
OPCUA Server: KepServerEX 6.8

I have set the certificate under trusted clients in KepserverEX (first i had to convert it to der).

Any help you could provide would be appreciated.

Annonymous user token polic error.txt
config_toml.txt

Certificate problem

Hi Jeroen,

I am trying to test your opcua-logger. After npm run start I get an error because of no certificate.

I have a machine with no internet access. Could you help me with this?

Thanks, Anant

Please see the logs:

image

image

How to set URI correctly

Hello,

i try to set up the logger correctly, here is my configuration:

[input]
url             = "opc.tcp://user:[email protected]:48010/UA"
failoverTimeout = 5000 # time to wait before reconnection in case of failure

[output]
name             = "influx_1"
type             = "influxdb"
host             = "172.18.0.2"
port             = 8086
protocol         = "http"
username         = ""
password         = ""
database         = "rh_linie_test"
failoverTimeout  = 10000
bufferMaxSize    = 64
writeInterval    = 3000
writeMaxPoints   = 1000

# A polled node:
#[[measurements]]
#name               = "Int16polled"
#tags               = { tag1 = "test", tag2 = "AB43" }
#tags               = { tag1 = "testtag" }
#nodeId             = "ns=4;s=RH Montage 2. Config.RH Master.GlobalVars.00DB ZEITEN_ZAEHLER.SPS_ZYKLUS_AKT"
#collectionType     = "polled"
#pollRate           = 60     # 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
[[measurements]]
name               = "Int32monitored"
dataType           = "number"
tags               = { tag1 = "test", tag2 = "AB43" }
nodeId             = "ns=4;s=RH Montage 2. Config.RH Master.GlobalVars.00DB ZEITEN_ZAEHLER.SPS_ZYKLUS_AKT"
collectionType     = "monitored"
monitorResolution  = 1000    # ms
deadbandAbsolute   = 0 		# Absolute max difference for a value not to be collected
deadbandRelative   = 0    	# Relative max difference for a value not to be collected

but all i get is the image in the attachment. It doesn't log to my influxdb.

Can you help me?

image

Difference polled and monitored

Hi,
frist of all: Love your logger. Really great work to monitor machines.

We connected Influx with Grafana and have problems with monitored values:
Although all data seems to be the same in Influx (polled or monitored), variables that are being monitored are not shown as graph in Grafana.

Polling obviously means that the value is read from the OPC UA Server.

Monitored probably refers to an OPC UA Subscription by the client and every change will be event-triggerd to the logger.

Now where is the difference in InfluxDB, so that grafana perfectly shows polled values but not monitored values?
Thanks,
Felix

Installation v2

Hi Jeroen,

I've been trying to install the logger v2 on Ubuntu 18.0.4.

Using npm install throws errors: Error: EACCES: permission denied, mkdir '/home/koen/node-opcua-logger-2/node_modules/node-opcua-certificate-manager/certificates'

Even a sudo npm install doesn't solve this.

I then tried sudo npm install --unsafe-perm=true --allow-root and that seemed to install ok. However, as soon as I ran 'node logger.js' I got an error: Error: Cannot find module 'nedb'. I resolved this by running sudo npm install nedb --save.

Next issue, again as soon as I run 'node logger.js', I get the following error

/home/koen/node-opcua-logger-2/writepump.js:18
	this.output = new influx({
	              ^

TypeError: influx is not a constructor
    at new WritePump (/home/koen/node-opcua-logger-2/writepump.js:18:16)
    at Object.<anonymous> (/home/koen/node-opcua-logger-2/logger.js:11:10)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

I then changed line 18 in writepump.js to this.output = new influx.InfluxDB({ and that made the issue go away. Perhaps the syntax for influx changed ?

Then, again when executing node logger.js, I get the following error:

/home/koen/node-opcua-logger-2/readpump.js:20
    self.uaClient.connect(self.uaServerUrl, function(err) {
                  ^

TypeError: self.uaClient.connect is not a function
    at ReadPump.ConnectOPCUA (/home/koen/node-opcua-logger-2/readpump.js:20:19)
    at /home/koen/node-opcua-logger-2/readpump.js:319:22
    at nextTask (/home/koen/node-opcua-logger-2/node_modules/async/dist/async.js:5324:14)
    at Object.waterfall (/home/koen/node-opcua-logger-2/node_modules/async/dist/async.js:5334:5)
    at ReadPump.Run (/home/koen/node-opcua-logger-2/readpump.js:316:11)
    at /home/koen/node-opcua-logger-2/logger.js:19:6
    at /home/koen/node-opcua-logger-2/node_modules/async/dist/async.js:3269:12
    at /home/koen/node-opcua-logger-2/node_modules/async/dist/async.js:74:12
    at next (/home/koen/node-opcua-logger-2/node_modules/async/dist/async.js:3514:9)
    at Object.forever (/home/koen/node-opcua-logger-2/node_modules/async/dist/async.js:3516:5)

This time I gave up. :-/ ... something seems fishy - surely something went wrong with my original install? I shouldn't have to chase errors like this to make it work, right? Or.... Could it have anything to do with this issue, commented on by E Rossignon late 2018 ?

Any suggestions?

Koen

Logger startup error

Hi,
if I try to start the logger I get the following error:

C:\node-opcua-logger-master>node logger.js
C:\node-opcua-logger-master\writepump.js:18
this.output = new influx({
^

TypeError: influx is not a constructor
at new WritePump (C:\node-opcua-logger-master\writepump.js:18:16)
at Object. (C:\node-opcua-logger-master\logger.js:11:10)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Nothing write into InfluxDB.

I am very sorry to bother you, but I can't solve this problem myself.

After running node logger.js, I got only one line output:

influx_1 : starting writepump [ writeLimit:  1000 , writeInterval: 3000 ].

also, and I can see influxd continuous output like following:

[httpd] 127.0.0.1 - - [01/Mar/2019:10:23:02 +0800] "POST /write?u=&p=&database=test&precision=ms&db=test HTTP/1.1" 204 0 "-" "-" f025f9ed-3bc8-11e9-8042-2c600c872352 100
[httpd] 127.0.0.1 - - [01/Mar/2019:10:23:05 +0800] "POST /write?u=&p=&database=test&precision=ms&db=test HTTP/1.1" 204 0 "-" "-" f1f11e43-3bc8-11e9-8043-2c600c872352 93
[httpd] 127.0.0.1 - - [01/Mar/2019:10:23:08 +0800] "POST /write?u=&p=&database=test&precision=ms&db=test HTTP/1.1" 204 0 "-" "-" f3bbe921-3bc8-11e9-8044-2c600c872352 69
[httpd] 127.0.0.1 - - [01/Mar/2019:10:23:11 +0800] "POST /write?u=&p=&database=test&precision=ms&db=test HTTP/1.1" 204 0 "-" "-" f5869f09-3bc8-11e9-8045-2c600c872352 167
[httpd] 127.0.0.1 - - [01/Mar/2019:10:23:14 +0800] "POST /write?u=&p=&database=test&precision=ms&db=test HTTP/1.1" 204 0 "-" "-" f75183ec-3bc8-11e9-8046-2c600c872352 166

It looks nomal, but actually I got nothing changed in my Influxed database, even the SHOW MEASUREMENTS found nothing.

In wireshark, I found those POST /write message followed by the words content-length:0 Connection:close.

...While I can see my value changed frequently in opcua-client.

More Information

  • InfluxDB v1.7.4
  • npm v6.8.0
  • nodejs v6.16.0

The config file config.toml for node-opcua-logger:

[input]
url             = "opc.tcp://192.168.1.33:4840/G02"
failoverTimeout = 5000 # time to wait before reconnection in case of failure

[output]
name             = "influx_1"
type             = "influxdb"
host             = "localhost"
port             = 8086
protocol         = "http"
username         = ""
password         = ""
database         = "test"
failoverTimeout  = 10000
bufferMaxSize    = 64
writeInterval    = 3000
writeMaxPoints   = 1000

# A polled node:
[[measurements]]
name               = "Omron_T048"
tags               = { tag1 = "test", tag2 = "T4028" }
nodeId             = "ns=2;s=OMRON.Tags.Timer.T4028"
collectionType     = "polled"
pollRate           = 60     # 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
[[measurements]]
name               = "Omron_T4030"
tags               = { tag1 = "test", tag2 = "T4030" }
nodeId             = "ns=2;s=OMRON.Tags.Timer.T4030"
collectionType     = "monitored"
monitorResolution  = 1000    # ms
deadbandAbsolute   = 0 		# Absolute max difference for a value not to be collected
deadbandRelative   = 0    	# Relative max difference for a value not to be collected

Thanks for your reading again.

How to connect to influxdb cloud database

Hello,

I am new to influxdb and try to connect a local OPC UA server to my influxdb cloud account. I managed to connect to the OPC UA server, but have no idea on what the url should be.

Can you help me on this?

Regards,

Jan Maasland

No return to work after DB-Restart

The code works quite good so far. Just one thing making problems here:
After disconnecting the machine with the logger from the influxDB-server the logger doesn't come back. It just throws some errors and then stop work completely. Therefore I have to restart the logger each time the network connection is interrupted or the InfluxDB is restarted. All the data produced in the meantime is lost.
As I unterstood in the description and config file, there should be some local buffering in a *.db-file and catch-up later.
Is there a possible misconfiguration on my side or is this feature just not working?

GUI with browsing server

Hello,
It is thought to develop a GUI where you can browse for tags over the OPC server? When you are reading almost 1000 tags and you need to update the client because the server has increased no of tags it's a bit painful. I have developed a macro which import a CSV from the server and export it in config.toml but I thing it's only a workaround.

Than you for the support.

Server Rejects Client

Hi
I am using Matrikon OPC simulation server to test the opc client
Here is the console log message

[2020-05-27T16:35:40.091] [INFO] main - Starting Influx OPCUA Logger v2.0.0-alpha, brought to you by FACTRY (www.factry.io) [2020-05-27T16:35:40.094] [INFO] main - Initialising influxClient [2020-05-27T16:35:40.111] [INFO] influx - localhost:8086 responded in 14ms running 1.7.2 [2020-05-27T16:35:40.112] [INFO] main - Initialising buffer [2020-05-27T16:35:40.116] [INFO] main - Connecting OPCUA [2020-05-27T16:35:47.144] [FATAL] main - Error: The connection has been rejected by server, Please check that client certificate is trusted by server. Err = (ERROR in waiting for data on socket ( timeout was = 60000 ms)) at Object.start (C:\TestProjects\NodeTests\OPC\SRC\node-opcua-logger-master\src\opcua.js:64:15) [2020-05-27T16:35:47.147] [INFO] buffer - Persisting membuffer.

Why is certificate rejected by the server?

Ajay

Synchronize node-opcua with Databases

How can I make it work both ways. For example, if some thing(a particular row in a table is modified, added or deleted) is changed in my DB, how can I let my opcua server know about it?

OpenSSL Issue

Hi,

First I want to say I'm pretty new at linux and so I apologize in advance is this is a minor issue with an obvious solution. I'm trying to get this package installed and upon running npm install from the node-opcua-logger directory I get several errors having to do with the creation of private keys and certificates using openSSL. I've attached a text file with all the errors (there were several, all related to openSSL). However they all appear to be duplicates of this:

###########OPENSSL ERROR ############
CWD = /home/bmcadmin/node-opcua-logger/node_modules/node-opcua-client
Command failed: "openssl" genrsa  -out "/home/bmcadmin/node-opcua-logger/node_modules/node-opcua-client/certificates/PKI/own/private/private_key.pem" -rand "/home/bmcadmin/node-opcua-logger/node_modules/node-opcua-client/certificates/PKI/own/private/random.rnd" 2048
Can't load /home/bmcadmin/node-opcua-logger/node_modules/node-opcua-client/certificates/PKI/own/private/random.rnd into RNG
139806547309696:error:2406F079:random number generator:RAND_load_file:Cannot open file:../crypto/rand/randfile.c:98:Filename=/home/bmcadmin/node-opcua-logger/node_modules/node-opcua-client/certificates/PKI/own/private/random.rnd
[OPCUA-Logger Errors.txt](https://github.com/coussej/node-opcua-logger/files/3238905/OPCUA-Logger.Errors.txt)

Thanks for any help resolving this issue!

Unable to parse

Hi,
I got this issue from alpha 2.0 build

 {"error":"unable to parse 'Oil 1 Real,equipment=Mixer\\ 1,status=Good value=12.5 1593421231055000000': invalid field format
unable to parse 'Cool Mix Control Temp,equipment=Mixer\\ 1,status=Good value=464 1593421231040000000': invalid field format

and this is the config for that metric

[[metrics]]
measurement = "Oil 1 Real"
dataType    = "number"
tags        = { equipment = "Mixer 1" }
nodeId      = "ns=2;s=_AdvancedTags.Oil Group.Oil 1 Real"
method      = "polled"
interval    = 300000

basically, all metrics are failed from being written to influxdb, any pointers for help?

Datatypes mismatch

We are running against an OPC UA server, inserting data into the InfluxDB. As such things seem fine - we are getting records continuously in the database. We are saving 2 things: timestamp and value. The value is a UInt64 which we can only map as a numerical value, which then gets automatically converted to Float behind the scenes, when in fact it should map to UInt64. As a result, the value gets inserted as 0 in the database. For strings and so on, it works well. How can we better control what it is converted to, behind the scenes?

InfluxDB storage as fields

I have going deeper in influxDB database (which is impressive) and I have noticed that we are storing each OPC tag as independent measurement. As I have several machines I would like to know if it would be possible to store a group of measurements as fields instead of measurements. Actually I am clasifying the measurements thanks to tag values but it would be good to have all the sensors of each machine under the same measurement "box" and treated as fields. I don't know if I have explained properly.

Thanks

Error: The connection has rejected by server

Hi, I am having a problem running the npm start command. It connects seamlessly to the database but when it wants to connect to the OPC UA it throws an error. I have configured the simulator and I am accessing through the url that provides me.
How should I do to configure the certificate correctly?

the opc ua server url is generated by the prosys opc ua server simulador

config.toml

[opcua]
url= "opc.tcp://c******:53530/OPCUA/SimulationServer"



[influx]
url              = "http://myuser:[email protected]:8086/OPC_DB"
writeInterval    = 1000          # optional. defaults to 1000ms
writeMaxPoints   = 1000          # optional. defaults to 1000 points


[[metrics]]
measurement        = "polled1"
datatype           = "number"
tags               = { simulation = "true", location = "ghent" }
nodeId             = "ns=5;s=Sinusoid1"
method             = "polled"
interval           = 1000     

[[metrics]]
measurement        = "monitored2"
datatype           = "boolean"
tags               = { simulation = "true", location = "ghent" }
nodeId             = "ns=3;s=BooleanDataItem"
method             = "monitored"
interval           = 5000  

PS C:\Users\user\Desktop\node-opcua-logger-master> npm run start

> [email protected] start C:\Users\user\Desktop\node-opcua-logger-master
> node ./src/index.js

[2020-06-09T15:02:58.987] [INFO] main - Starting Influx OPCUA Logger v2.0.0-alpha, brought to you by FACTRY (www.factry.
io)
[2020-06-09T15:02:58.989] [INFO] main - Initialising influxClient
[2020-06-09T15:02:59.009] [INFO] influx - 192.168.1.10:8086 responded in 16ms running 1.8.0
[2020-06-09T15:02:59.010] [INFO] main - Initialising buffer
[2020-06-09T15:02:59.012] [INFO] main - Connecting OPCUA
[2020-06-09T15:02:59.051] [FATAL] main - Error: The connection has been rejected by server,
Please check that client certificate is trusted by server.
Err = (Internal Error)
    at Object.start (C:\Users\user\Desktop\node-opcua-logger-master\src\opcua.js:60:11)
[2020-06-09T15:02:59.053] [INFO] buffer - Persisting membuffer.

Thanks

Help on error with starting

I am wondering if you could help me with this error I am getting when trying to run node logger.js:

Error:
influx_1 : starting writepump [ writeLimit: 1000 , writeInterval: 3000 ].
/Users/Sanna/node-opcua-logger/node_modules/better-assert/index.js:37
throw err;
^

AssertionError [ERR_ASSERTION]: fs.existsSync(options.certificateFile)
at new AssertionError (internal/errors.js:102:11)
at assert (/Users/Sanna/node-opcua-logger/node_modules/better-assert/index.js:32:13)
at OPCUAClientBase (/Users/Sanna/node-opcua-logger/node_modules/node-opcua/lib/client/client_base.js:65:5)
at new OPCUAClient (/Users/Sanna/node-opcua-logger/node_modules/node-opcua/lib/client/opcua_client.js:67:21)
at new ReadPump (/Users/Sanna/node-opcua-logger/readpump.js:8:21)
at Object. (/Users/Sanna/node-opcua-logger/logger.js:15:10)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)

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

[output]
name = "influx_1"
type = "influxdb"
host = "127.0.0.1"
port = 8088
protocol = "http"
username = ""
password = ""
database = "pilot"
failoverTimeout = 10000
bufferMaxSize = 64
writeInterval = 3000
writeMaxPoints = 1000

A polled node:

[[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

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

I am able to connect with the OPC with a client. I am also able to write to InfluxDB on command line.

Thank you.

support for deadband in v2

Hi,

Are there plans for adding deadband facilities, similar to the first version of the logger?

kind regards
Pascal

Difference between polled and monitored + function of deadband

Hi,

Nicely working application!
I do have a question about the exact functionality. I did some tests and my conclusion about the functionality of polled and monitored is as follows:
Polled:

  • works cyclic, as expected, logs xx samples/minute

  • deadband check: deadbandvalues are taken into account, so logging is conditional if deadbandvalues are used (<>0)

Monitored:

  • works event driven, checks value every xx ms (monitorresolution)

  • deadband values do not seem to have influence, unconditional logging, if opc value has changed, even the slightest amount, so deadband values do not seem to have any influence.

Can someone confirm this? If so, is this as foreseen?

kind regards
Pascal

add some variable whith ofset

Hello im explain me
I Want to pull array of sensor data (vibration)
every 100ms 50 variable of trace refresh.
sample 0 is time 0 sample 1 is 2ms later ....
but now if i pull each sample in one variable is seem complicated to make calculation in grafana.
Now i think is possible to make timestamp delays in variable and put sample in unique variable but whith 2 ms delay ?

Connection reject by server

Hi,

I've an error when I connect to my OPC Server.

Error: The connection has been rejected by server, Please check that client certificate is trusted by server. Err = (connect ETIMEDOUT xxx.xxx.xxx.xxx:4840) at Object.start (/snapshot/node-opcua-logger/src/opcua.js:0:0)

I use anonymous auth.

I try with UA Expert Client and it's ok.

What's the certificate?

Regards

Unauthorized error

Hello, I am trying to send data from OPCUA Server to InfluxDB 2.0 using your plugin, but I am getting an unauthorized error. First I thought that I used wrong token, which didn't have needed permissions but I checked that and I don't see any problem here. So I would be really thankfull if you could help me.

Here is log containing error message
[2020-10-12T13:28:13.747] [INFO] main - Starting Influx OPCUA Logger v2.0.0-alpha, brought to you by FACTRY (www.factry.io)
[2020-10-12T13:28:13.750] [INFO] main - Initialising influxClient
[2020-10-12T13:28:13.822] [INFO] influx - 192.168.0.25:8086 responded in 63ms running
[2020-10-12T13:28:13.832] [INFO] main - Initialising buffer
[2020-10-12T13:28:13.838] [INFO] main - Connecting OPCUA
[2020-10-12T13:28:13.842] [INFO] buffer - Start processing of bufferfile { file: '/home/data/_queue/1602493702208_0.json' }
[2020-10-12T13:28:13.866] [ERROR] influx - A 401 Unauthorized error occurred: {"code":"unauthorized","message":"unauthorized access"}
[2020-10-12T13:28:13.867] [ERROR] buffer - Error writing points { error:
'A 401 Unauthorized error occurred: {"code":"unauthorized","message":"unauthorized access"}' }
[2020-10-12T13:22:01.403] [INFO] opcuaclient - Established connection. { Endpoint: 'opc.tcp://192.168.0.21:12345' }
[2020-10-12T13:22:01.484] [INFO] opcuaclient - Established session with server. { ID: 26 }
[2020-10-12T13:22:01.486] [INFO] opcuaclient - Added Polled Metric. { measurement: 'U-L1L2[V]',
tags: { simulation: 'true', location: 'Levice' },
nodeId: 'ns=4;s=Sensor_Simulator:InputRegisters:0:0' }
[2020-10-12T13:22:01.486] [INFO] opcuaclient - Added Polled Metric. { measurement: 'U-L2L3[V]',
tags: { simulation: 'true', location: 'Levice' },
nodeId: 'ns=4;s=Sensor_Simulator:InputRegisters:1:0' }
[2020-10-12T13:22:01.487] [INFO] opcuaclient - Added Polled Metric. { measurement: 'U-L3L1[V]',
tags: { simulation: 'true', location: 'Sala' },
nodeId: 'ns=4;s=Sensor_Simulator:InputRegisters:2:0' }
[2020-10-12T13:22:01.520] [INFO] opcuaclient - Installed subscription on session. { ID: 84 }
[2020-10-12T13:22:02.397] [INFO] buffer - Start processing of bufferfile { file: '/home/data/_queue/1602493702208_0.json' }
[2020-10-12T13:22:02.403] [ERROR] influx - A 401 Unauthorized error occurred: {"code":"unauthorized","message":"unauthorized access"}
[2020-10-12T13:22:02.404] [ERROR] buffer - Error writing points { error:
'A 401 Unauthorized error occurred: {"code":"unauthorized","message":"unauthorized access"}' }

And here is my config file
[opcua]
url = "opc.tcp://192.168.0.21:12345"

[influx]
url = "http://lukas:[email protected]:8086/snmpbucket"
token = "oI67t9BXnHnoYtWRl7YBen9pbZGQngrFje39gBr1WC8TMPk46gclqPFGOS3OK_-eb84EUOg_zRPJth74hp1Paw=="
org = "myorg"
bucket = "snmpbucket"
writeInterval = 10000

OPC UA Server Close

Hi Jeroen,

First of all thanks again for your really nice app. Its working perfectly but I have a small problem.
I want to know if its possible to do something in case of the OPC UA server is restarting due to an update of software in PLC.
Like a loop to retry many times a reconnection with the OPC UA server and not to close the app like it is actually.

Thanks a lot

Didier

Different timestamps on monitored and polled

As #7 different timestamps are probably used. Polled does not take the opcua timestamp but the one at moment of polling. Should be opcua timestamp which is supposed to be the moment the value was generated.

_queue size

Hello,

I am using this software for a bit of time and I am suffering some computer stuck ramdonly. I have discovered that folder _queue is enormous and has a lot of files. Just to investigate I would like to know why number of files doesn't stop to grow and if it would be possible to limit it.

Thanks in advance.

How to connect multiple devices and containerization

Hello,
I have two questions:

Firstly;

Can you tell me how can I connect two or more plcs with your software, please?

Let's say I have two devices:
opc.tcp://bla.bla.bla.1
opc.tcp://bla.bla.bla.2

How a config file and measurements look like for this setup?

Secondly,

How can I run your software in Docker?

Thank you,

run from binary problem

Hi,

I've got Windows Server 2016 with opc ua server on it. I was trying to use your application with binary option. As far as I understood from description i do not need to install nodeJS, do I?
I'm receving following errors (screenshot).

What should i do :)?
issue_inf

Best regards

Best Architecture

Hello and thanks in advance,
I would like to know which architecture do you recommends in my case. I have several machines which belongs same OPC server. 1. Do you recommend one instance of your software per machine or only one?
2. Do you recommend one influxdb per machine or only one?

I would like to know advantages/disadvantages (or incompatibilities)

Thank you in advance.

Roadmap and TODO list

Hi @coussej ,

Thanks for the great work you are doing along with this open source historian.

Does this project have a roadmap or todo list with features that you are planning for the community version?

Regards,
Lucas

Missing config files

The instruction: โ€ For reference, two example config files are provided in the example_config folder.โ€
Cant find the files...

OPC Status monitoring

Hello, good morning.

I continue working with this excellent software. It works really well.
I am trying to implement an alert system which uses red and green color to represent the opcstatus quality of all of my assets but I am having some issues, I don't really know if they come from node-opcua-logger or if they come from InfluxDB query.
The goal is very simple, to represent the status of the machines OPC using red and green colors dependig on opc quality "good" or bad".

Attached you can find a sample screenshot:
Capture

Attached you can find a sample config file. All the tags that I am using are called "OPC" and are booleans.
`# A polled node

#XXXXXX_CNC
[[measurements]]
name="OPC"
dataType="boolean"
tags= {plant="XXXX", asset="XXXX", device="CNC"}
nodeId="ns=2;s=XXXXXXXXXXXXXXXXXXXX"
collectionType="polled"
pollRate=1#samples/minute
deadbandAbsolute=0
deadbandRelative=0

'# A polled node

#XXXXXXXXXXX_CNC
[[measurements]]
name="OPC"
dataType="boolean"
tags= {plant="XXXXX", asset="XXXX", device="PC"}
nodeId="ns=2;s=XXXXXXXXXXXXXXXXXXXXXXXX"
collectionType="polled"
pollRate=1#samples/minute
deadbandAbsolute=0
deadbandRelative=0
`
Capture3

Attached you can find InfluxDB query in Grafana:
Capture2

Could you help me? Something that I can show is that apparently, values are not recorded when quality is "Bad".

Thanks in advance!!!

Influxdb v2.0 compatibility

Hi, I want to know if it is compatible with influxdb v2 and if so how to configure it.
Thank you

Regards

Domenico

memory full due to influxdb connection issue

Hi there , first of all thx for the great work , while deploying it to test env running on LWS VPS , I have faced repetitive memory leaks visible in the below graphs

It looks like the tool wasn't able to write the acquired data inside the influxDB , stored it in local buffer 'till the memory got exhausted and process crashed

Setup is such

Siemens HMI located in BEL <-OPC-UA -> VPS running OPCUA-logger in PARIS LWS <-> influxDB running on the same VPS , GRAFANA running on the same VPS and consuming the data inside influxDB.

image

Haven't had time yet to dig on it , but will in the coming days , it looks more a pb on the influx DB , but will check that

See below generated logs

[2019-10-30T18:15:23.486] [ERROR] buffer - Failed to write points from membuffer. { error: 'connect ECONNREFUSED 127.0.0.1:8086' }
[2019-10-30T18:15:23.487] [ERROR] buffer - Will try again in 5s.
[2019-10-30T18:15:28.490] [ERROR] influx - connect ECONNREFUSED 127.0.0.1:8086
[2019-10-30T18:15:28.491] [ERROR] buffer - Failed to write points from membuffer. { error: 'connect ECONNREFUSED 127.0.0.1:8086' }
[2019-10-30T18:15:28.491] [ERROR] buffer - Will try again in 5s.
[2019-10-30T18:15:33.495] [ERROR] influx - connect ECONNREFUSED 127.0.0.1:8086
[2019-10-30T18:15:33.495] [ERROR] buffer - Failed to write points from membuffer. { error: 'connect ECONNREFUSED 127.0.0.1:8086' }
[2019-10-30T18:15:33.496] [ERROR] buffer - Will try again in 5s.
[2019-10-30T18:15:38.498] [ERROR] influx - connect ECONNREFUSED 127.0.0.1:8086
[2019-10-30T18:15:38.498] [ERROR] buffer - Failed to write points from membuffer. { error: 'connect ECONNREFUSED 127.0.0.1:8086' }
[2019-10-30T18:15:38.498] [ERROR] buffer - Will try again in 5s.
[2019-10-30T18:15:43.501] [ERROR] influx - connect ECONNREFUSED 127.0.0.1:8086
[2019-10-30T18:15:43.501] [ERROR] buffer - Failed to write points from membuffer. { error: 'connect ECONNREFUSED 127.0.0.1:8086' }
[2019-10-30T18:15:43.501] [ERROR] buffer - Will try again in 5s.
[2019-10-30T18:15:48.504] [ERROR] influx - connect ECONNREFUSED 127.0.0.1:8086
[2019-10-30T18:15:48.505] [ERROR] buffer - Failed to write points from membuffer. { error: 'connect ECONNREFUSED 127.0.0.1:8086' }
[2019-10-30T18:15:48.505] [ERROR] buffer - Will try again in 5s.
[2019-10-30T18:15:53.589] [ERROR] influx - No host available
[2019-10-30T18:15:53.589] [ERROR] buffer - Failed to write points from membuffer. { error: 'No host available' }
[2019-10-30T18:15:53.589] [ERROR] buffer - Will try again in 5s.
[2019-10-30T18:15:58.593] [ERROR] influx - connect ECONNREFUSED 127.0.0.1:8086
[2019-10-30T18:15:58.593] [ERROR] buffer - Failed to write points from membuffer. { error: 'connect ECONNREFUSED 127.0.0.1:8086' }
[2019-10-30T18:15:58.593] [ERROR] buffer - Will try again in 5s.
[2019-10-30T18:16:03.596] [ERROR] influx - No host available
[2019-10-30T18:16:03.596] [ERROR] buffer - Failed to write points from membuffer. { error: 'No host available' }
[2019-10-30T18:16:03.597] [ERROR] buffer - Will try again in 5s.
[2019-10-30T18:16:08.599] [ERROR] influx - connect ECONNREFUSED 127.0.0.1:8086
[2019-10-30T18:16:08.599] [ERROR] buffer - Failed to write points from membuffer. { error: 'connect ECONNREFUSED 127.0.0.1:8086' }
[2019-10-30T18:16:08.600] [ERROR] buffer - Will try again in 20s.
[2019-10-30T18:31:37.510] [WARN] opcuaclient - Time travel detected: drift: 510. Skipping tick.
[2019-10-30T18:31:38.002] [WARN] opcuaclient - Tick discrepancy: 38 vs 36
Timeout .... waiting for response for OpenSecureChannelRequest { /RequestHeader/
authenticationToken /* NodeId /: ns=0;i=0
timestamp /
DateTime /: 2019-10-31T02:39:50.298Z
requestHandle /
UInt32 /: 241864 0x3b0c8
returnDiagnostics /
UInt32 /: 0 0x0
auditEntryId /
UAString /: null
timeoutHint /
UInt32 /: 0 0x0
additionalHeader /
ExtensionObject */: null
};
[2019-10-31T03:56:32.780] [INFO] opcuaclient - Socket was closed!
[2019-10-31T03:56:32.781] [FATAL] main - connection_break
[2019-10-31T03:56:32.781] [INFO] buffer - Persisting membuffer.
[root@vps51703 ~]#

Error: Cannot find module 'node-opcua'

After installing node v11.13.0, and

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

I got the far below error.

I also tried:

$ npm install node-opcua

but no success.

Thanks.

$node logger.js
internal/modules/cjs/loader.js:657
    throw err;
    ^

Error: Cannot find module 'node-opcua'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:655:15)
    at Function.Module._load (internal/modules/cjs/loader.js:580:25)
    at Module.require (internal/modules/cjs/loader.js:711:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (C:\use\node-opcua-logger\readpump.js:4:13)
    at Module._compile (internal/modules/cjs/loader.js:805:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10)
    at Module.load (internal/modules/cjs/loader.js:672:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:612:12)
    at Function.Module._load (internal/modules/cjs/loader.js:604:3)

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Hello coussej,

I am testing your code "at limits" (more than 300 tags) but after a while, I receive the following error. It seems to be related with the total memory used by "opclogger.db".
In the moment of this error, this file had 198.019kb which is a lot of memory.

Could you have a look? Thank you a lot.

`
at C:\Program Files\node-opcua-logger-master\node_modules\influx\index.js:67:23
at InfluxRequest._parseCallback (C:\Program Files\node-opcua-logger-master\node_modules\influx\lib\InfluxRequest.js:122:10)
at Request._callback (C:\Program Files\node-opcua-logger-master\node_modules\influx\lib\InfluxRequest.js:111:10)
at Request.self.callback (C:\Program Files\node-opcua-logger-master\node_modules\request\request.js:185:22)
at Request.emit (events.js:189:13)
at Request. (C:\Program Files\node-opcua-logger-master\node_modules\request\request.js:1161:10)
at Request.emit (events.js:189:13)
at IncomingMessage. (C:\Program Files\node-opcua-logger-master\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:277:13)
at IncomingMessage.emit (events.js:194:15)

<--- Last few GCs --->

[34036:00000148C03AD2C0] 1206855 ms: Mark-sweep 1008.2 (1067.6) -> 1008.2 (1034.6) MB, 746.0 / 0.0 ms (average mu = 0.476, current mu = 0.000) last resort GC in old space requested
[34036:00000148C03AD2C0] 1207602 ms: Mark-sweep 1008.2 (1034.6) -> 1008.2 (1034.6) MB, 747.0 / 0.0 ms (average mu = 0.306, current mu = 0.000) last resort GC in old space requested

<--- JS stacktrace --->

==== JS stack trace =========================================

0: ExitFrame [pc: 0000024CF41079E0]

Security context: 0x01975e19e6e9
1: byteLength(aka byteLength) [000002C1B21F80D9] [buffer.js:~509] [pc=0000024CF55BD137](this=0x002ecd2026f1 ,string=0x007524a2e0f9 <Very long string[202771045]>,encoding=0x01975e1be311 <String[4]: utf8>)
2: arguments adaptor frame: 3->2
3: from [000002394879E8E9] [buffer.js:~199] [pc=0000024CF55C85CF](this=0x02c1b21d2b29 <JSFunction ...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: 00007FF77538F04A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+5114
2: 00007FF77536A0C6 node::MakeCallback+4518
3: 00007FF77536AA30 node_module_register+2032
4: 00007FF7755F20EE v8::internal::FatalProcessOutOfMemory+846
5: 00007FF7755F201F v8::internal::FatalProcessOutOfMemory+639
6: 00007FF775B12BC4 v8::internal::Heap::MaxHeapGrowingFactor+9556
7: 00007FF775B110CB v8::internal::Heap::MaxHeapGrowingFactor+2651
8: 00007FF7756CCA3B v8::internal::Factory::AllocateRawWithImmortalMap+59
9: 00007FF7756CF4ED v8::internal::Factory::NewRawTwoByteString+77
10: 00007FF7758D9AA8 v8::internal::Smi::SmiPrint+536
11: 00007FF7755E582B v8::internal::StringHasher::UpdateIndex+219
12: 00007FF77560AB26 v8::String::Utf8Length+22
13: 00007FF77535370C node::Buffer::New+4332
14: 0000024CF41079E0

C:\Program Files\node-opcua-logger-master>
`

Sampling Time

Hi, loving node-opcua-logger so far :)

Are there any plans in the near future to have millisecond timing implemented to get data in ?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.