node-opcua-vendor-diagnostic 2.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/vendor_diagnostic_nodes.d.ts +9 -0
- package/dist/vendor_diagnostic_nodes.js +250 -0
- package/dist/vendor_diagnostic_nodes.js.map +1 -0
- package/package.json +37 -0
- package/source/index.ts +1 -0
- package/source/vendor_diagnostic_nodes.ts +278 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2021 Etienne Rossignon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./vendor_diagnostic_nodes";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./vendor_diagnostic_nodes"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4DAA0C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* optionally install a CPU Usage and Memory Usage node
|
|
4
|
+
* ( condition : running on linux and require("usage")
|
|
5
|
+
* @method install_optional_cpu_and_memory_usage_node
|
|
6
|
+
* @param server {OPCUAServer}
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export declare function install_optional_cpu_and_memory_usage_node(server: any): void;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.install_optional_cpu_and_memory_usage_node = void 0;
|
|
4
|
+
/* istanbul ignore file */
|
|
5
|
+
// tslint:disable:no-console
|
|
6
|
+
const os = require("os");
|
|
7
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
8
|
+
const node_opcua_constants_1 = require("node-opcua-constants");
|
|
9
|
+
const node_opcua_server_1 = require("node-opcua-server");
|
|
10
|
+
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
11
|
+
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
12
|
+
// tslint:disable:no-var-requires
|
|
13
|
+
const humanize = require("humanize");
|
|
14
|
+
/**
|
|
15
|
+
* @method addVariableWithHumanizeText
|
|
16
|
+
* @param namespace
|
|
17
|
+
* @param options
|
|
18
|
+
* @param options.browseName
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
function addVariableWithHumanizeText(namespace, options) {
|
|
22
|
+
(0, node_opcua_assert_1.assert)(options.componentOf || options.organizedBy);
|
|
23
|
+
(0, node_opcua_assert_1.assert)(typeof options.description === "string");
|
|
24
|
+
const variable = namespace.addVariable(options);
|
|
25
|
+
// add the xxxAsText property
|
|
26
|
+
namespace.addVariable({
|
|
27
|
+
propertyOf: variable,
|
|
28
|
+
browseName: options.browseName.name.toString() + "AsText",
|
|
29
|
+
dataType: "String",
|
|
30
|
+
description: options.description + " as text",
|
|
31
|
+
minimumSamplingInterval: options.minimumSamplingInterval,
|
|
32
|
+
value: {
|
|
33
|
+
get() {
|
|
34
|
+
const v = options.value.get();
|
|
35
|
+
if (v instanceof node_opcua_variant_1.Variant) {
|
|
36
|
+
return v;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.String, value: humanize.filesize(v.value) });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* optionally install a CPU Usage and Memory Usage node
|
|
48
|
+
* ( condition : running on linux and require("usage")
|
|
49
|
+
* @method install_optional_cpu_and_memory_usage_node
|
|
50
|
+
* @param server {OPCUAServer}
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
function install_optional_cpu_and_memory_usage_node(server) {
|
|
54
|
+
const engine = server.engine;
|
|
55
|
+
(0, node_opcua_assert_1.assert)(engine instanceof node_opcua_server_1.ServerEngine);
|
|
56
|
+
let usage;
|
|
57
|
+
try {
|
|
58
|
+
const usage_module = "usage"; // we use a variable here to prevent error in webpack
|
|
59
|
+
usage = require(usage_module); // a warning will be generated here with webpack as the module name is not a litteral
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
if (err instanceof Error) {
|
|
63
|
+
console.log("err", err.message);
|
|
64
|
+
}
|
|
65
|
+
usage = null;
|
|
66
|
+
// xx return;
|
|
67
|
+
}
|
|
68
|
+
const addressSpace = engine.addressSpace;
|
|
69
|
+
const namespace = addressSpace.getOwnNamespace();
|
|
70
|
+
const vendorServerInfo = addressSpace.findNode(node_opcua_constants_1.ObjectIds.Server_VendorServerInfo);
|
|
71
|
+
let usage_result = { memory: 0, cpu: 100 };
|
|
72
|
+
const pid = process.pid;
|
|
73
|
+
if (usage) {
|
|
74
|
+
const options = { keepHistory: true };
|
|
75
|
+
setInterval(() => {
|
|
76
|
+
usage.lookup(pid, options, (err, result) => {
|
|
77
|
+
usage_result = result;
|
|
78
|
+
console.log("result Used Memory: ", humanize.filesize(result.memory), " CPU ", Math.round(result.cpu), " %");
|
|
79
|
+
if (err) {
|
|
80
|
+
console.log("err ", err);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}, 1000);
|
|
84
|
+
namespace.addVariable({
|
|
85
|
+
componentOf: vendorServerInfo,
|
|
86
|
+
browseName: "CPUUsage",
|
|
87
|
+
dataType: "Double",
|
|
88
|
+
description: "Current CPU usage of the server process",
|
|
89
|
+
minimumSamplingInterval: 1000,
|
|
90
|
+
nodeId: "s=CPUUsage",
|
|
91
|
+
value: {
|
|
92
|
+
get: () => {
|
|
93
|
+
if (!usage_result) {
|
|
94
|
+
return node_opcua_status_code_1.StatusCodes.BadResourceUnavailable;
|
|
95
|
+
}
|
|
96
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.Double, value: Math.round(usage_result.cpu) });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
addVariableWithHumanizeText(namespace, {
|
|
101
|
+
componentOf: vendorServerInfo,
|
|
102
|
+
browseName: "MemoryUsage",
|
|
103
|
+
dataType: "Number",
|
|
104
|
+
description: "Current memory usage of the server process",
|
|
105
|
+
minimumSamplingInterval: 1000,
|
|
106
|
+
nodeId: "s=MemoryUsage",
|
|
107
|
+
value: {
|
|
108
|
+
get: () => {
|
|
109
|
+
if (!usage_result) {
|
|
110
|
+
return node_opcua_status_code_1.StatusCodes.BadResourceUnavailable;
|
|
111
|
+
}
|
|
112
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.UInt32, value: usage_result.memory });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
console.log("skipping installation of cpu_usage and memory_usage nodes");
|
|
119
|
+
}
|
|
120
|
+
namespace.addVariable({
|
|
121
|
+
componentOf: vendorServerInfo,
|
|
122
|
+
browseName: "PercentageMemoryUsed",
|
|
123
|
+
dataType: "Number",
|
|
124
|
+
description: "% of memory used by the server",
|
|
125
|
+
minimumSamplingInterval: 1000,
|
|
126
|
+
nodeId: "s=PercentageMemoryUsed",
|
|
127
|
+
value: {
|
|
128
|
+
get() {
|
|
129
|
+
const percent_used = Math.round(((os.totalmem() - os.freemem()) / os.totalmem()) * 100);
|
|
130
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.Double, value: percent_used });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
addVariableWithHumanizeText(namespace, {
|
|
135
|
+
componentOf: vendorServerInfo,
|
|
136
|
+
accessLevel: "CurrentRead",
|
|
137
|
+
browseName: "SystemMemoryTotal",
|
|
138
|
+
dataType: "Number",
|
|
139
|
+
description: "Total Memory usage of the server",
|
|
140
|
+
minimumSamplingInterval: 1000,
|
|
141
|
+
nodeId: "s=SystemMemoryTotal",
|
|
142
|
+
value: {
|
|
143
|
+
get() {
|
|
144
|
+
const memory = os.totalmem();
|
|
145
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.UInt64, value: memory });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
addVariableWithHumanizeText(namespace, {
|
|
150
|
+
componentOf: vendorServerInfo,
|
|
151
|
+
accessLevel: "CurrentRead",
|
|
152
|
+
browseName: "SystemMemoryFree",
|
|
153
|
+
dataType: "Number",
|
|
154
|
+
description: "Free Memory usage of the server in MB",
|
|
155
|
+
minimumSamplingInterval: 1000,
|
|
156
|
+
nodeId: "s=SystemMemoryFree",
|
|
157
|
+
value: {
|
|
158
|
+
get() {
|
|
159
|
+
const memory = os.freemem();
|
|
160
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.UInt64, value: memory });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
namespace.addVariable({
|
|
165
|
+
componentOf: vendorServerInfo,
|
|
166
|
+
accessLevel: "CurrentRead",
|
|
167
|
+
browseName: "NumberOfCPUs",
|
|
168
|
+
dataType: "Number",
|
|
169
|
+
description: "Number of cpus on the server",
|
|
170
|
+
minimumSamplingInterval: 1000,
|
|
171
|
+
nodeId: "s=NumberOfCPUs",
|
|
172
|
+
value: {
|
|
173
|
+
get() {
|
|
174
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.UInt32, value: os.cpus().length });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
namespace.addVariable({
|
|
179
|
+
componentOf: vendorServerInfo,
|
|
180
|
+
accessLevel: "CurrentRead",
|
|
181
|
+
browseName: "Arch",
|
|
182
|
+
dataType: "String",
|
|
183
|
+
description: "ServerArchitecture",
|
|
184
|
+
minimumSamplingInterval: 1000,
|
|
185
|
+
nodeId: "s=ServerArchitecture",
|
|
186
|
+
value: {
|
|
187
|
+
get() {
|
|
188
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.String, value: os.type() });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
addVariableWithHumanizeText(namespace, {
|
|
193
|
+
componentOf: vendorServerInfo,
|
|
194
|
+
accessLevel: "CurrentRead",
|
|
195
|
+
browseName: "BytesWritten",
|
|
196
|
+
dataType: "Number",
|
|
197
|
+
description: "number of bytes written by the server",
|
|
198
|
+
minimumSamplingInterval: 1000,
|
|
199
|
+
nodeId: "s=BytesWritten",
|
|
200
|
+
value: {
|
|
201
|
+
get() {
|
|
202
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.UInt64, value: server.bytesWritten });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
addVariableWithHumanizeText(namespace, {
|
|
207
|
+
componentOf: vendorServerInfo,
|
|
208
|
+
accessLevel: "CurrentRead",
|
|
209
|
+
browseName: "BytesRead",
|
|
210
|
+
dataType: "Number",
|
|
211
|
+
description: "number of bytes read by the server",
|
|
212
|
+
minimumSamplingInterval: 1000,
|
|
213
|
+
nodeId: "s=BytesRead",
|
|
214
|
+
value: {
|
|
215
|
+
get() {
|
|
216
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.UInt64, value: server.bytesRead });
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
namespace.addVariable({
|
|
221
|
+
componentOf: vendorServerInfo,
|
|
222
|
+
accessLevel: "CurrentRead",
|
|
223
|
+
browseName: "TransactionsCount",
|
|
224
|
+
dataType: "Number",
|
|
225
|
+
description: "total number of transactions performed the server",
|
|
226
|
+
minimumSamplingInterval: 1000,
|
|
227
|
+
nodeId: "s=TransactionsCount",
|
|
228
|
+
value: {
|
|
229
|
+
get() {
|
|
230
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.UInt32, value: server.transactionsCount });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
namespace.addVariable({
|
|
235
|
+
componentOf: vendorServerInfo,
|
|
236
|
+
accessLevel: "CurrentRead",
|
|
237
|
+
browseName: "ConnectionsCount",
|
|
238
|
+
dataType: "String",
|
|
239
|
+
description: "number of active Connections",
|
|
240
|
+
minimumSamplingInterval: 1000,
|
|
241
|
+
nodeId: "s=ConnectionCount",
|
|
242
|
+
value: {
|
|
243
|
+
get() {
|
|
244
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.String, value: humanize.filesize(server.currentChannelCount) });
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
exports.install_optional_cpu_and_memory_usage_node = install_optional_cpu_and_memory_usage_node;
|
|
250
|
+
//# sourceMappingURL=vendor_diagnostic_nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendor_diagnostic_nodes.js","sourceRoot":"","sources":["../source/vendor_diagnostic_nodes.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AAC1B,4BAA4B;AAC5B,yBAAyB;AAGzB,yDAA2C;AAC3C,+DAAiD;AACjD,yDAAiD;AACjD,mEAAqD;AACrD,2DAAuD;AACvD,iCAAiC;AACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAErC;;;;;;GAMG;AACH,SAAS,2BAA2B,CAAC,SAAoB,EAAE,OAAY;IACnE,IAAA,0BAAM,EAAC,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACnD,IAAA,0BAAM,EAAC,OA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
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc -b",
|
|
9
|
+
"clean": "node -e \"require('rimraf').sync('dist');\"",
|
|
10
|
+
"test": "echo no test"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"humanize": "0.0.9",
|
|
14
|
+
"node-opcua-address-space": "2.51.0",
|
|
15
|
+
"node-opcua-assert": "2.51.0",
|
|
16
|
+
"node-opcua-constants": "2.51.0",
|
|
17
|
+
"node-opcua-server": "2.51.0",
|
|
18
|
+
"node-opcua-status-code": "2.51.0",
|
|
19
|
+
"node-opcua-variant": "2.51.0"
|
|
20
|
+
},
|
|
21
|
+
"author": "Etienne Rossignon",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git://github.com/node-opcua/node-opcua.git"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"OPCUA",
|
|
29
|
+
"opcua",
|
|
30
|
+
"m2m",
|
|
31
|
+
"iot",
|
|
32
|
+
"opc ua",
|
|
33
|
+
"internet of things"
|
|
34
|
+
],
|
|
35
|
+
"homepage": "http://node-opcua.github.io/",
|
|
36
|
+
"gitHead": "75feb111daf7ec65fa0111e4fa5beb8987fd4945"
|
|
37
|
+
}
|
package/source/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./vendor_diagnostic_nodes";
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/* istanbul ignore file */
|
|
2
|
+
// tslint:disable:no-console
|
|
3
|
+
import * as os from "os";
|
|
4
|
+
|
|
5
|
+
import { Namespace } from "node-opcua-address-space";
|
|
6
|
+
import { assert } from "node-opcua-assert";
|
|
7
|
+
import { ObjectIds } from "node-opcua-constants";
|
|
8
|
+
import { ServerEngine } from "node-opcua-server";
|
|
9
|
+
import { StatusCodes } from "node-opcua-status-code";
|
|
10
|
+
import { DataType, Variant } from "node-opcua-variant";
|
|
11
|
+
// tslint:disable:no-var-requires
|
|
12
|
+
const humanize = require("humanize");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @method addVariableWithHumanizeText
|
|
16
|
+
* @param namespace
|
|
17
|
+
* @param options
|
|
18
|
+
* @param options.browseName
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
function addVariableWithHumanizeText(namespace: Namespace, options: any) {
|
|
22
|
+
assert(options.componentOf || options.organizedBy);
|
|
23
|
+
assert(typeof options.description === "string");
|
|
24
|
+
|
|
25
|
+
const variable = namespace.addVariable(options);
|
|
26
|
+
// add the xxxAsText property
|
|
27
|
+
namespace.addVariable({
|
|
28
|
+
propertyOf: variable,
|
|
29
|
+
|
|
30
|
+
browseName: options.browseName.name.toString() + "AsText",
|
|
31
|
+
dataType: "String",
|
|
32
|
+
description: options.description + " as text",
|
|
33
|
+
minimumSamplingInterval: options.minimumSamplingInterval,
|
|
34
|
+
value: {
|
|
35
|
+
get() {
|
|
36
|
+
const v = options.value.get();
|
|
37
|
+
if (v instanceof Variant) {
|
|
38
|
+
return v;
|
|
39
|
+
} else {
|
|
40
|
+
return new Variant({ dataType: DataType.String, value: humanize.filesize(v.value) });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* optionally install a CPU Usage and Memory Usage node
|
|
50
|
+
* ( condition : running on linux and require("usage")
|
|
51
|
+
* @method install_optional_cpu_and_memory_usage_node
|
|
52
|
+
* @param server {OPCUAServer}
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
export function install_optional_cpu_and_memory_usage_node(server: any) {
|
|
56
|
+
const engine = server.engine;
|
|
57
|
+
assert(engine instanceof ServerEngine);
|
|
58
|
+
|
|
59
|
+
let usage: any;
|
|
60
|
+
try {
|
|
61
|
+
const usage_module = "usage"; // we use a variable here to prevent error in webpack
|
|
62
|
+
usage = require(usage_module); // a warning will be generated here with webpack as the module name is not a litteral
|
|
63
|
+
} catch (err) {
|
|
64
|
+
if (err instanceof Error) {
|
|
65
|
+
console.log("err", err.message);
|
|
66
|
+
}
|
|
67
|
+
usage = null;
|
|
68
|
+
// xx return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const addressSpace = engine.addressSpace;
|
|
72
|
+
|
|
73
|
+
const namespace = addressSpace.getOwnNamespace();
|
|
74
|
+
|
|
75
|
+
const vendorServerInfo = addressSpace.findNode(ObjectIds.Server_VendorServerInfo);
|
|
76
|
+
|
|
77
|
+
let usage_result = { memory: 0, cpu: 100 };
|
|
78
|
+
|
|
79
|
+
const pid = process.pid;
|
|
80
|
+
|
|
81
|
+
if (usage) {
|
|
82
|
+
const options = { keepHistory: true };
|
|
83
|
+
setInterval(() => {
|
|
84
|
+
usage.lookup(pid, options, (err: Error | null, result: any) => {
|
|
85
|
+
usage_result = result;
|
|
86
|
+
console.log("result Used Memory: ", humanize.filesize(result.memory), " CPU ", Math.round(result.cpu), " %");
|
|
87
|
+
if (err) {
|
|
88
|
+
console.log("err ", err);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}, 1000);
|
|
92
|
+
|
|
93
|
+
namespace.addVariable({
|
|
94
|
+
componentOf: vendorServerInfo,
|
|
95
|
+
|
|
96
|
+
browseName: "CPUUsage",
|
|
97
|
+
dataType: "Double",
|
|
98
|
+
description: "Current CPU usage of the server process",
|
|
99
|
+
|
|
100
|
+
minimumSamplingInterval: 1000,
|
|
101
|
+
nodeId: "s=CPUUsage",
|
|
102
|
+
value: {
|
|
103
|
+
get: () => {
|
|
104
|
+
if (!usage_result) {
|
|
105
|
+
return StatusCodes.BadResourceUnavailable;
|
|
106
|
+
}
|
|
107
|
+
return new Variant({ dataType: DataType.Double, value: Math.round(usage_result.cpu) });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
addVariableWithHumanizeText(namespace, {
|
|
113
|
+
componentOf: vendorServerInfo,
|
|
114
|
+
|
|
115
|
+
browseName: "MemoryUsage",
|
|
116
|
+
dataType: "Number",
|
|
117
|
+
description: "Current memory usage of the server process",
|
|
118
|
+
minimumSamplingInterval: 1000,
|
|
119
|
+
nodeId: "s=MemoryUsage",
|
|
120
|
+
value: {
|
|
121
|
+
get: () => {
|
|
122
|
+
if (!usage_result) {
|
|
123
|
+
return StatusCodes.BadResourceUnavailable;
|
|
124
|
+
}
|
|
125
|
+
return new Variant({ dataType: DataType.UInt32, value: usage_result.memory });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
} else {
|
|
130
|
+
console.log("skipping installation of cpu_usage and memory_usage nodes");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
namespace.addVariable({
|
|
134
|
+
componentOf: vendorServerInfo,
|
|
135
|
+
|
|
136
|
+
browseName: "PercentageMemoryUsed",
|
|
137
|
+
dataType: "Number",
|
|
138
|
+
description: "% of memory used by the server",
|
|
139
|
+
minimumSamplingInterval: 1000,
|
|
140
|
+
nodeId: "s=PercentageMemoryUsed",
|
|
141
|
+
value: {
|
|
142
|
+
get() {
|
|
143
|
+
const percent_used = Math.round(((os.totalmem() - os.freemem()) / os.totalmem()) * 100);
|
|
144
|
+
return new Variant({ dataType: DataType.Double, value: percent_used });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
addVariableWithHumanizeText(namespace, {
|
|
150
|
+
componentOf: vendorServerInfo,
|
|
151
|
+
|
|
152
|
+
accessLevel: "CurrentRead",
|
|
153
|
+
browseName: "SystemMemoryTotal",
|
|
154
|
+
dataType: "Number",
|
|
155
|
+
description: "Total Memory usage of the server",
|
|
156
|
+
minimumSamplingInterval: 1000,
|
|
157
|
+
nodeId: "s=SystemMemoryTotal",
|
|
158
|
+
value: {
|
|
159
|
+
get() {
|
|
160
|
+
const memory = os.totalmem();
|
|
161
|
+
return new Variant({ dataType: DataType.UInt64, value: memory });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
addVariableWithHumanizeText(namespace, {
|
|
167
|
+
componentOf: vendorServerInfo,
|
|
168
|
+
|
|
169
|
+
accessLevel: "CurrentRead",
|
|
170
|
+
browseName: "SystemMemoryFree",
|
|
171
|
+
dataType: "Number",
|
|
172
|
+
description: "Free Memory usage of the server in MB",
|
|
173
|
+
minimumSamplingInterval: 1000,
|
|
174
|
+
nodeId: "s=SystemMemoryFree",
|
|
175
|
+
value: {
|
|
176
|
+
get() {
|
|
177
|
+
const memory = os.freemem();
|
|
178
|
+
return new Variant({ dataType: DataType.UInt64, value: memory });
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
namespace.addVariable({
|
|
184
|
+
componentOf: vendorServerInfo,
|
|
185
|
+
|
|
186
|
+
accessLevel: "CurrentRead",
|
|
187
|
+
browseName: "NumberOfCPUs",
|
|
188
|
+
dataType: "Number",
|
|
189
|
+
description: "Number of cpus on the server",
|
|
190
|
+
minimumSamplingInterval: 1000,
|
|
191
|
+
nodeId: "s=NumberOfCPUs",
|
|
192
|
+
value: {
|
|
193
|
+
get() {
|
|
194
|
+
return new Variant({ dataType: DataType.UInt32, value: os.cpus().length });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
namespace.addVariable({
|
|
200
|
+
componentOf: vendorServerInfo,
|
|
201
|
+
|
|
202
|
+
accessLevel: "CurrentRead",
|
|
203
|
+
browseName: "Arch",
|
|
204
|
+
dataType: "String",
|
|
205
|
+
description: "ServerArchitecture",
|
|
206
|
+
minimumSamplingInterval: 1000,
|
|
207
|
+
nodeId: "s=ServerArchitecture",
|
|
208
|
+
value: {
|
|
209
|
+
get() {
|
|
210
|
+
return new Variant({ dataType: DataType.String, value: os.type() });
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
addVariableWithHumanizeText(namespace, {
|
|
216
|
+
componentOf: vendorServerInfo,
|
|
217
|
+
|
|
218
|
+
accessLevel: "CurrentRead",
|
|
219
|
+
browseName: "BytesWritten",
|
|
220
|
+
dataType: "Number",
|
|
221
|
+
description: "number of bytes written by the server",
|
|
222
|
+
minimumSamplingInterval: 1000,
|
|
223
|
+
nodeId: "s=BytesWritten",
|
|
224
|
+
value: {
|
|
225
|
+
get() {
|
|
226
|
+
return new Variant({ dataType: DataType.UInt64, value: server.bytesWritten });
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
addVariableWithHumanizeText(namespace, {
|
|
232
|
+
componentOf: vendorServerInfo,
|
|
233
|
+
|
|
234
|
+
accessLevel: "CurrentRead",
|
|
235
|
+
browseName: "BytesRead",
|
|
236
|
+
dataType: "Number",
|
|
237
|
+
description: "number of bytes read by the server",
|
|
238
|
+
minimumSamplingInterval: 1000,
|
|
239
|
+
nodeId: "s=BytesRead",
|
|
240
|
+
value: {
|
|
241
|
+
get() {
|
|
242
|
+
return new Variant({ dataType: DataType.UInt64, value: server.bytesRead });
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
namespace.addVariable({
|
|
248
|
+
componentOf: vendorServerInfo,
|
|
249
|
+
|
|
250
|
+
accessLevel: "CurrentRead",
|
|
251
|
+
browseName: "TransactionsCount",
|
|
252
|
+
dataType: "Number",
|
|
253
|
+
description: "total number of transactions performed the server",
|
|
254
|
+
minimumSamplingInterval: 1000,
|
|
255
|
+
nodeId: "s=TransactionsCount",
|
|
256
|
+
value: {
|
|
257
|
+
get() {
|
|
258
|
+
return new Variant({ dataType: DataType.UInt32, value: server.transactionsCount });
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
namespace.addVariable({
|
|
264
|
+
componentOf: vendorServerInfo,
|
|
265
|
+
|
|
266
|
+
accessLevel: "CurrentRead",
|
|
267
|
+
browseName: "ConnectionsCount",
|
|
268
|
+
dataType: "String",
|
|
269
|
+
description: "number of active Connections",
|
|
270
|
+
minimumSamplingInterval: 1000,
|
|
271
|
+
nodeId: "s=ConnectionCount",
|
|
272
|
+
value: {
|
|
273
|
+
get() {
|
|
274
|
+
return new Variant({ dataType: DataType.String, value: humanize.filesize(server.currentChannelCount) });
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}
|