@resolveio/server-lib 9.10.2 → 10.0.1
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/collections/app-status.collection.js +11 -1
- package/collections/app-status.collection.js.map +1 -1
- package/collections/app-version.collection.js +11 -1
- package/collections/app-version.collection.js.map +1 -1
- package/collections/counter.collection.js +11 -1
- package/collections/counter.collection.js.map +1 -1
- package/collections/cron-job-history.collection.js +11 -1
- package/collections/cron-job-history.collection.js.map +1 -1
- package/collections/cron-job.collection.js +11 -1
- package/collections/cron-job.collection.js.map +1 -1
- package/collections/email-history.collection.js +11 -1
- package/collections/email-history.collection.js.map +1 -1
- package/collections/email-verified.collection.js +11 -1
- package/collections/email-verified.collection.js.map +1 -1
- package/collections/file.collection.js +11 -1
- package/collections/file.collection.js.map +1 -1
- package/collections/flag.collection.js +11 -1
- package/collections/flag.collection.js.map +1 -1
- package/collections/log-method-latency.collection.js +11 -1
- package/collections/log-method-latency.collection.js.map +1 -1
- package/collections/log-subscription.collection.js +11 -1
- package/collections/log-subscription.collection.js.map +1 -1
- package/collections/log.collection.js +11 -1
- package/collections/log.collection.js.map +1 -1
- package/collections/logged-in-users.collection.js +11 -1
- package/collections/logged-in-users.collection.js.map +1 -1
- package/collections/method-response.collection.js +11 -1
- package/collections/method-response.collection.js.map +1 -1
- package/collections/monitor-cpu.collection.js +24 -19
- package/collections/monitor-cpu.collection.js.map +1 -1
- package/collections/monitor-memory.collection.js +24 -18
- package/collections/monitor-memory.collection.js.map +1 -1
- package/collections/monitor-mongo.collection.js +24 -18
- package/collections/monitor-mongo.collection.js.map +1 -1
- package/collections/notification.collection.js +11 -1
- package/collections/notification.collection.js.map +1 -1
- package/collections/report-builder-dashboard-builder.collection.js +11 -1
- package/collections/report-builder-dashboard-builder.collection.js.map +1 -1
- package/collections/report-builder-library.collection.js +11 -1
- package/collections/report-builder-library.collection.js.map +1 -1
- package/collections/report-builder-report.collection.js +11 -1
- package/collections/report-builder-report.collection.js.map +1 -1
- package/collections/user-group.collection.js +11 -1
- package/collections/user-group.collection.js.map +1 -1
- package/collections/user-guide.collection.js +11 -1
- package/collections/user-guide.collection.js.map +1 -1
- package/collections/user.collection.js +11 -1
- package/collections/user.collection.js.map +1 -1
- package/managers/mongo.manager.d.ts +17 -3
- package/managers/mongo.manager.js +43 -26
- package/managers/mongo.manager.js.map +1 -1
- package/managers/monitor.manager.js +25 -90
- package/managers/monitor.manager.js.map +1 -1
- package/methods/monitor.js +20 -32
- package/methods/monitor.js.map +1 -1
- package/models/monitor-cpu.model.d.ts +5 -2
- package/models/monitor-cpu.model.js.map +1 -1
- package/models/monitor-memory.model.d.ts +5 -2
- package/models/monitor-memory.model.js.map +1 -1
- package/models/monitor-mongo.model.d.ts +5 -2
- package/models/monitor-mongo.model.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +0 -4
- package/public_api.js +0 -4
- package/public_api.js.map +1 -1
- package/collections/monitor-https-inbound.collection.d.ts +0 -3
- package/collections/monitor-https-inbound.collection.js +0 -67
- package/collections/monitor-https-inbound.collection.js.map +0 -1
- package/collections/monitor-https-outbound.collection.d.ts +0 -3
- package/collections/monitor-https-outbound.collection.js +0 -75
- package/collections/monitor-https-outbound.collection.js.map +0 -1
- package/models/monitor-https-inbound.model.d.ts +0 -11
- package/models/monitor-https-inbound.model.js +0 -4
- package/models/monitor-https-inbound.model.js.map +0 -1
- package/models/monitor-https-outbound.model.d.ts +0 -12
- package/models/monitor-https-outbound.model.js +0 -4
- package/models/monitor-https-outbound.model.js.map +0 -1
|
@@ -40,8 +40,6 @@ exports.MonitorManager = void 0;
|
|
|
40
40
|
var bent = require("bent");
|
|
41
41
|
var monitor_cpu_collection_1 = require("../collections/monitor-cpu.collection");
|
|
42
42
|
var monitor_memory_collection_1 = require("../collections/monitor-memory.collection");
|
|
43
|
-
var monitor_https_inbound_collection_1 = require("../collections/monitor-https-inbound.collection");
|
|
44
|
-
var monitor_https_outbound_collection_1 = require("../collections/monitor-https-outbound.collection");
|
|
45
43
|
var monitor_mongo_collection_1 = require("../collections/monitor-mongo.collection");
|
|
46
44
|
var index_1 = require("../index");
|
|
47
45
|
var common_1 = require("../util/common");
|
|
@@ -63,7 +61,7 @@ var MonitorManager = /** @class */ (function () {
|
|
|
63
61
|
for (var entry in env) {
|
|
64
62
|
console.log(entry + ':' + env[entry]);
|
|
65
63
|
if (entry === 'environment.HOSTNAME') {
|
|
66
|
-
_this._instanceHostname = env[entry].replace('ip-', '')
|
|
64
|
+
_this._instanceHostname = env[entry].replace('ip-', '');
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
;
|
|
@@ -73,9 +71,10 @@ var MonitorManager = /** @class */ (function () {
|
|
|
73
71
|
if (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {
|
|
74
72
|
monitor_cpu_collection_1.MonitorCPUs.create({
|
|
75
73
|
_id: mongo_manager_1.objectIdHexString(),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
metadata: {
|
|
75
|
+
instance: this._instanceHostname,
|
|
76
|
+
client: this._serverConfig['CLIENT_NAME']
|
|
77
|
+
},
|
|
79
78
|
date: new Date(data.time),
|
|
80
79
|
app: data.process,
|
|
81
80
|
system: data.system
|
|
@@ -84,8 +83,10 @@ var MonitorManager = /** @class */ (function () {
|
|
|
84
83
|
else {
|
|
85
84
|
if (this._instanceHostname) {
|
|
86
85
|
this._monitorData.push({
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
metadata: {
|
|
87
|
+
instance: this._instanceHostname,
|
|
88
|
+
client: this._serverConfig['CLIENT_NAME']
|
|
89
|
+
},
|
|
89
90
|
date: new Date(data.time),
|
|
90
91
|
type: 'cpu',
|
|
91
92
|
app: data.process,
|
|
@@ -101,9 +102,10 @@ var MonitorManager = /** @class */ (function () {
|
|
|
101
102
|
if (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {
|
|
102
103
|
monitor_memory_collection_1.MonitorMemorys.create({
|
|
103
104
|
_id: mongo_manager_1.objectIdHexString(),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
metadata: {
|
|
106
|
+
instance: this._instanceHostname,
|
|
107
|
+
client: this._serverConfig['CLIENT_NAME']
|
|
108
|
+
},
|
|
107
109
|
date: new Date(data.time),
|
|
108
110
|
physical_total: data.physical_total,
|
|
109
111
|
physical_used: data.physical_used,
|
|
@@ -116,8 +118,10 @@ var MonitorManager = /** @class */ (function () {
|
|
|
116
118
|
else {
|
|
117
119
|
if (this._instanceHostname) {
|
|
118
120
|
this._monitorData.push({
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
metadata: {
|
|
122
|
+
instance: this._instanceHostname,
|
|
123
|
+
client: this._serverConfig['CLIENT_NAME']
|
|
124
|
+
},
|
|
121
125
|
date: new Date(data.time),
|
|
122
126
|
type: 'memory',
|
|
123
127
|
physical_total: data.physical_total,
|
|
@@ -132,87 +136,16 @@ var MonitorManager = /** @class */ (function () {
|
|
|
132
136
|
return [2 /*return*/];
|
|
133
137
|
});
|
|
134
138
|
}); });
|
|
135
|
-
this._monitorAgent.on('https', function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
136
|
-
return __generator(this, function (_a) {
|
|
137
|
-
if (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {
|
|
138
|
-
monitor_https_inbound_collection_1.MonitorHTTPSInbounds.create({
|
|
139
|
-
_id: mongo_manager_1.objectIdHexString(),
|
|
140
|
-
__v: 0,
|
|
141
|
-
instance: this._instanceHostname,
|
|
142
|
-
client: this._serverConfig['CLIENT_NAME'],
|
|
143
|
-
date: new Date(data.time),
|
|
144
|
-
method: data.method,
|
|
145
|
-
url: data.url,
|
|
146
|
-
duration: data.duration,
|
|
147
|
-
contentType: data.contentType,
|
|
148
|
-
requestHeader: data.requestHeader
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
if (this._instanceHostname) {
|
|
153
|
-
this._monitorData.push({
|
|
154
|
-
instance: this._instanceHostname,
|
|
155
|
-
client: this._serverConfig['CLIENT_NAME'],
|
|
156
|
-
date: new Date(data.time),
|
|
157
|
-
type: 'https-inbound',
|
|
158
|
-
method: data.method,
|
|
159
|
-
url: data.url,
|
|
160
|
-
duration: data.duration,
|
|
161
|
-
contentType: data.contentType,
|
|
162
|
-
requestHeader: data.requestHeader
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return [2 /*return*/];
|
|
167
|
-
});
|
|
168
|
-
}); });
|
|
169
|
-
this._monitorAgent.on('https-outbound', function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
170
|
-
return __generator(this, function (_a) {
|
|
171
|
-
if (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {
|
|
172
|
-
monitor_https_outbound_collection_1.MonitorHTTPSOutbounds.create({
|
|
173
|
-
_id: mongo_manager_1.objectIdHexString(),
|
|
174
|
-
__v: 0,
|
|
175
|
-
instance: this._instanceHostname,
|
|
176
|
-
client: this._serverConfig['CLIENT_NAME'],
|
|
177
|
-
date: new Date(data.time),
|
|
178
|
-
method: data.method,
|
|
179
|
-
url: data.url,
|
|
180
|
-
duration: data.duration,
|
|
181
|
-
status: data.status,
|
|
182
|
-
contentType: data.contentType,
|
|
183
|
-
requestHeaders: data.requestHeaders
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
if (!data.url.startsWith('https://backend.resolveio.com/api/monitor/')) {
|
|
188
|
-
if (this._instanceHostname) {
|
|
189
|
-
this._monitorData.push({
|
|
190
|
-
instance: this._instanceHostname,
|
|
191
|
-
client: this._serverConfig['CLIENT_NAME'],
|
|
192
|
-
date: new Date(data.time),
|
|
193
|
-
type: 'https-outbound',
|
|
194
|
-
method: data.method,
|
|
195
|
-
url: data.url,
|
|
196
|
-
duration: data.duration,
|
|
197
|
-
status: data.status,
|
|
198
|
-
contentType: data.contentType,
|
|
199
|
-
requestHeaders: data.requestHeaders
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return [2 /*return*/];
|
|
205
|
-
});
|
|
206
|
-
}); });
|
|
207
139
|
this._monitorAgent.on('mongo', function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
208
140
|
return __generator(this, function (_a) {
|
|
209
141
|
if (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {
|
|
210
142
|
if (!data.collection.startsWith('monitor-')) {
|
|
211
143
|
monitor_mongo_collection_1.MonitorMongos.create({
|
|
212
144
|
_id: mongo_manager_1.objectIdHexString(),
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
145
|
+
metadata: {
|
|
146
|
+
instance: this._instanceHostname,
|
|
147
|
+
client: this._serverConfig['CLIENT_NAME']
|
|
148
|
+
},
|
|
216
149
|
date: new Date(data.time),
|
|
217
150
|
method: data.method,
|
|
218
151
|
doc_collection: data.collection,
|
|
@@ -224,8 +157,10 @@ var MonitorManager = /** @class */ (function () {
|
|
|
224
157
|
else {
|
|
225
158
|
if (this._instanceHostname) {
|
|
226
159
|
this._monitorData.push({
|
|
227
|
-
|
|
228
|
-
|
|
160
|
+
metadata: {
|
|
161
|
+
instance: this._instanceHostname,
|
|
162
|
+
client: this._serverConfig['CLIENT_NAME']
|
|
163
|
+
},
|
|
229
164
|
date: new Date(data.time),
|
|
230
165
|
type: 'mongo',
|
|
231
166
|
method: data.method,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/managers/monitor.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2BAA6B;AAC7B,gFAAoE;AACpE,sFAA0E;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E,KAAK,CAAC,CAAC;IACX,CAAC;IACF,qBAAC;AAAD,CA/QA,AA+QC,IAAA;AA/QY,wCAAc","file":"monitor.manager.js","sourcesContent":["import ResolveIOMainServer from '../server-app';\nimport * as bent from 'bent';\nimport { MonitorCPUs } from '../collections/monitor-cpu.collection';\nimport { MonitorMemorys } from '../collections/monitor-memory.collection';\nimport { MonitorHTTPSInbounds } from '../collections/monitor-https-inbound.collection';\nimport { MonitorHTTPSOutbounds } from '../collections/monitor-https-outbound.collection';\nimport { MonitorMongos } from '../collections/monitor-mongo.collection';\nimport { ResolveIOServer } from '../index';\nimport { deepCopy } from '../util/common';\nimport { objectIdHexString } from './mongo.manager';\n\nexport class MonitorManager {\n\tprivate _mainServer: ResolveIOMainServer;\n\tprivate _monitorAgent;\n\tprivate _serverConfig;\n\tprivate _instanceHostname = '';\n\tprivate _monitorData = [];\n\n\tconstructor(mainServer, monitorAgent, serverConfig) {\n\t\tthis._mainServer = mainServer;\n\t\tthis._monitorAgent = monitorAgent;\n\t\tthis._serverConfig = serverConfig;\n\n\t\tthis.setupEvents();\n\t\tthis.setupEventLoop();\n\t}\n\n\tsetupEvents() {\t\t\n\t\tthis._monitorAgent.on('initialized', (env) => {\n\t\t\tenv = this._monitorAgent.getEnvironment();\n\t\t\tfor (let entry in env) {\n\t\t\t\tconsole.log(entry + ':' + env[entry]);\n\t\t\t\tif (entry === 'environment.HOSTNAME') {\n\t\t\t\t\tthis._instanceHostname = env[entry].replace('ip-', '').replace(/-/g, '.');\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t\t\n\t\tthis._monitorAgent.on('cpu', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {\n\t\t\t\tMonitorCPUs.create({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tapp: data.process,\n\t\t\t\t\tsystem: data.system\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (this._instanceHostname) {\n\t\t\t\t\tthis._monitorData.push({\n\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\t\ttype: 'cpu',\n\t\t\t\t\t\tapp: data.process,\n\t\t\t\t\t\tsystem: data.system\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('memory', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {\n\t\t\t\tMonitorMemorys.create({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tphysical_total: data.physical_total,\n\t\t\t\t\tphysical_used: data.physical_used,\n\t\t\t\t\tphysical_free: data.physical_free,\n\t\t\t\t\tvirtual: data.virtual,\n\t\t\t\t\tprivate: data.private,\n\t\t\t\t\tphysical: data.physical\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (this._instanceHostname) {\n\t\t\t\t\tthis._monitorData.push({\n\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\t\ttype: 'memory',\n\t\t\t\t\t\tphysical_total: data.physical_total,\n\t\t\t\t\t\tphysical_used: data.physical_used,\n\t\t\t\t\t\tphysical_free: data.physical_free,\n\t\t\t\t\t\tvirtual: data.virtual,\n\t\t\t\t\t\tprivate: data.private,\n\t\t\t\t\t\tphysical: data.physical\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('https', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {\n\t\t\t\tMonitorHTTPSInbounds.create({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tmethod: data.method,\n\t\t\t\t\turl: data.url,\n\t\t\t\t\tduration: data.duration,\n\t\t\t\t\tcontentType: data.contentType,\n\t\t\t\t\trequestHeader: data.requestHeader\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (this._instanceHostname) {\n\t\t\t\t\tthis._monitorData.push({\n\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\t\ttype: 'https-inbound',\n\t\t\t\t\t\tmethod: data.method,\n\t\t\t\t\t\turl: data.url,\n\t\t\t\t\t\tduration: data.duration,\n\t\t\t\t\t\tcontentType: data.contentType,\n\t\t\t\t\t\trequestHeader: data.requestHeader\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('https-outbound', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {\n\t\t\t\tMonitorHTTPSOutbounds.create({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tmethod: data.method,\n\t\t\t\t\turl: data.url,\n\t\t\t\t\tduration: data.duration,\n\t\t\t\t\tstatus: data.status,\n\t\t\t\t\tcontentType: data.contentType,\n\t\t\t\t\trequestHeaders: data.requestHeaders\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (!data.url.startsWith('https://backend.resolveio.com/api/monitor/')) {\n\t\t\t\t\tif (this._instanceHostname) {\n\t\t\t\t\t\tthis._monitorData.push({\n\t\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\t\t\ttype: 'https-outbound',\n\t\t\t\t\t\t\tmethod: data.method,\n\t\t\t\t\t\t\turl: data.url,\n\t\t\t\t\t\t\tduration: data.duration,\n\t\t\t\t\t\t\tstatus: data.status,\n\t\t\t\t\t\t\tcontentType: data.contentType,\n\t\t\t\t\t\t\trequestHeaders: data.requestHeaders\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('mongo', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {\n\t\t\t\tif (!data.collection.startsWith('monitor-')) {\n\t\t\t\t\tMonitorMongos.create({\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\t\tmethod: data.method,\n\t\t\t\t\t\tdoc_collection: data.collection,\n\t\t\t\t\t\tduration: data.duration,\n\t\t\t\t\t\tquery: data.query\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (this._instanceHostname) {\n\t\t\t\t\tthis._monitorData.push({\n\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\t\ttype: 'mongo',\n\t\t\t\t\t\tmethod: data.method,\n\t\t\t\t\t\tdoc_collection: data.collection,\n\t\t\t\t\t\tduration: data.duration,\n\t\t\t\t\t\tquery: data.query\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('eventloop', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {\n\t\t\t\tconsole.log(JSON.stringify(data, null, 2));\n\t\t\t}\n\t\t});\n\n\t\t// this._monitorAgent.on('socket', async (data) => {\n\t\t// \tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {\n\n\t\t// \t}\n\t\t// \telse {\n\t\t// \t\tconst response = await post('/api/monitor/socket', {\n\t\t// \t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t// \t\t\tdate: new Date(data.time),\n\t\t\t\t\t\n\t\t// \t\t});\n\t\t// \t}\n\t\t// });\n\t}\n\n\tsetupEventLoop() {\n\t\tsetTimeout(async () => {\n\t\t\tif (this._monitorData.length) {\n\t\t\t\tconst post = bent('https://backend.resolveio.com', 'POST', 'json', 200);\n\n\t\t\t\tlet monitorData = deepCopy(this._monitorData);\n\t\t\t\tthis._monitorData = [];\n\n\t\t\t\tlet size = JSON.stringify(monitorData).replace(/[\\[\\]\\,\\\"]/g,'').length * 8;\n\n\t\t\t\tif (size < 45000000) { // 50 MB size limit\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst response = await post('/api/monitor', monitorData);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\tif (e.statusCode !== 500 && e.statusCode !== 501 && e.statusCode !== 502 && e.statusCode !== 503 && e.statusCode !== 504) {\n\t\t\t\t\t\t\tResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', 'RESOLVEIO MONITOR HTTP - Error Detected', JSON.stringify(e, null, 2));\n\n\t\t\t\t\t\t\tconsole.log(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet tmpData = [];\n\t\t\t\t\tfor (let i = 0; i < monitorData.length; i++) {\n\t\t\t\t\t\ttmpData.push(monitorData[i]);\n\t\t\t\t\t\tsize = JSON.stringify(tmpData).replace(/[\\[\\]\\,\\\"]/g,'').length * 8;\n\n\t\t\t\t\t\tif (size > 45000000) {\n\t\t\t\t\t\t\ttmpData.pop();\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst response = await post('/api/monitor', tmpData);\n\n\t\t\t\t\t\t\t\ttmpData = [monitorData[i]];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\t\t\tif (e.statusCode !== 500 && e.statusCode !== 501 && e.statusCode !== 502 && e.statusCode !== 503 && e.statusCode !== 504) {\n\t\t\t\t\t\t\t\t\tResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', 'RESOLVEIO MONITOR HTTP - Error Detected', JSON.stringify(e, null, 2));\n\t\t\n\t\t\t\t\t\t\t\t\tconsole.log(e);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (tmpData.length) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst response = await post('/api/monitor', tmpData);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\t\tif (e.statusCode !== 500 && e.statusCode !== 501 && e.statusCode !== 502 && e.statusCode !== 503 && e.statusCode !== 504) {\n\t\t\t\t\t\t\t\tResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', 'RESOLVEIO MONITOR HTTP - Error Detected', JSON.stringify(e, null, 2));\n\t\n\t\t\t\t\t\t\t\tconsole.log(e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.setupEventLoop();\n\t\t}, 60000);\n\t}\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/managers/monitor.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2BAA6B;AAC7B,gFAAoE;AACpE,sFAA0E;AAC1E,oFAAwE;AACxE,kCAA2C;AAC3C,yCAA0C;AAC1C,iDAAoD;AAEpD;IAOC,wBAAY,UAAU,EAAE,YAAY,EAAE,YAAY;QAH1C,sBAAiB,GAAG,EAAE,CAAC;QACvB,iBAAY,GAAG,EAAE,CAAC;QAGzB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAElC,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,cAAc,EAAE,CAAC;IACvB,CAAC;IAED,oCAAW,GAAX;QAAA,iBAkIC;QAjIA,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,aAAa,EAAE,UAAC,GAAG;YACxC,GAAG,GAAG,KAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;YAC1C,KAAK,IAAI,KAAK,IAAI,GAAG,EAAE;gBACtB,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;gBACtC,IAAI,KAAK,KAAK,sBAAsB,EAAE;oBACrC,KAAI,CAAC,iBAAiB,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;iBACvD;aACD;YAAA,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IA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,CAAC,UAAU,KAAK,GAAG,EAAE;4BACzH,uBAAe,CAAC,aAAa,EAAE,CAAC,gBAAgB,EAAE,CAAC,SAAS,CAAC,mBAAmB,EAAE,yCAAyC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;4BAEzJ,OAAO,CAAC,GAAG,CAAC,GAAC,CAAC,CAAC;yBACf;;;wBAML,IAAI,CAAC,cAAc,EAAE,CAAC;;;;aACtB,EAAE,KAAK,CAAC,CAAC;IACX,CAAC;IACF,qBAAC;AAAD,CApNA,AAoNC,IAAA;AApNY,wCAAc","file":"monitor.manager.js","sourcesContent":["import ResolveIOMainServer from '../server-app';\nimport * as bent from 'bent';\nimport { MonitorCPUs } from '../collections/monitor-cpu.collection';\nimport { MonitorMemorys } from '../collections/monitor-memory.collection';\nimport { MonitorMongos } from '../collections/monitor-mongo.collection';\nimport { ResolveIOServer } from '../index';\nimport { deepCopy } from '../util/common';\nimport { objectIdHexString } from './mongo.manager';\n\nexport class MonitorManager {\n\tprivate _mainServer: ResolveIOMainServer;\n\tprivate _monitorAgent;\n\tprivate _serverConfig;\n\tprivate _instanceHostname = '';\n\tprivate _monitorData = [];\n\n\tconstructor(mainServer, monitorAgent, serverConfig) {\n\t\tthis._mainServer = mainServer;\n\t\tthis._monitorAgent = monitorAgent;\n\t\tthis._serverConfig = serverConfig;\n\n\t\tthis.setupEvents();\n\t\tthis.setupEventLoop();\n\t}\n\n\tsetupEvents() {\t\t\n\t\tthis._monitorAgent.on('initialized', (env) => {\n\t\t\tenv = this._monitorAgent.getEnvironment();\n\t\t\tfor (let entry in env) {\n\t\t\t\tconsole.log(entry + ':' + env[entry]);\n\t\t\t\tif (entry === 'environment.HOSTNAME') {\n\t\t\t\t\tthis._instanceHostname = env[entry].replace('ip-', '');\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t\t\n\t\tthis._monitorAgent.on('cpu', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {\n\t\t\t\tMonitorCPUs.create({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME']\n\t\t\t\t\t},\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tapp: data.process,\n\t\t\t\t\tsystem: data.system\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (this._instanceHostname) {\n\t\t\t\t\tthis._monitorData.push({\n\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME']\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\t\ttype: 'cpu',\n\t\t\t\t\t\tapp: data.process,\n\t\t\t\t\t\tsystem: data.system\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('memory', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {\n\t\t\t\tMonitorMemorys.create({\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME']\n\t\t\t\t\t},\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tphysical_total: data.physical_total,\n\t\t\t\t\tphysical_used: data.physical_used,\n\t\t\t\t\tphysical_free: data.physical_free,\n\t\t\t\t\tvirtual: data.virtual,\n\t\t\t\t\tprivate: data.private,\n\t\t\t\t\tphysical: data.physical\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (this._instanceHostname) {\n\t\t\t\t\tthis._monitorData.push({\n\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME']\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\t\ttype: 'memory',\n\t\t\t\t\t\tphysical_total: data.physical_total,\n\t\t\t\t\t\tphysical_used: data.physical_used,\n\t\t\t\t\t\tphysical_free: data.physical_free,\n\t\t\t\t\t\tvirtual: data.virtual,\n\t\t\t\t\t\tprivate: data.private,\n\t\t\t\t\t\tphysical: data.physical\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('mongo', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {\n\t\t\t\tif (!data.collection.startsWith('monitor-')) {\n\t\t\t\t\tMonitorMongos.create({\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME']\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\t\tmethod: data.method,\n\t\t\t\t\t\tdoc_collection: data.collection,\n\t\t\t\t\t\tduration: data.duration,\n\t\t\t\t\t\tquery: data.query\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (this._instanceHostname) {\n\t\t\t\t\tthis._monitorData.push({\n\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME']\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\t\ttype: 'mongo',\n\t\t\t\t\t\tmethod: data.method,\n\t\t\t\t\t\tdoc_collection: data.collection,\n\t\t\t\t\t\tduration: data.duration,\n\t\t\t\t\t\tquery: data.query\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('eventloop', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {\n\t\t\t\tconsole.log(JSON.stringify(data, null, 2));\n\t\t\t}\n\t\t});\n\n\t\t// this._monitorAgent.on('socket', async (data) => {\n\t\t// \tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com' || this._serverConfig['ROOT_URL'] === 'http://localhost:4200') {\n\n\t\t// \t}\n\t\t// \telse {\n\t\t// \t\tconst response = await post('/api/monitor/socket', {\n\t\t// \t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t// \t\t\tdate: new Date(data.time),\n\t\t\t\t\t\n\t\t// \t\t});\n\t\t// \t}\n\t\t// });\n\t}\n\n\tsetupEventLoop() {\n\t\tsetTimeout(async () => {\n\t\t\tif (this._monitorData.length) {\n\t\t\t\tconst post = bent('https://backend.resolveio.com', 'POST', 'json', 200);\n\n\t\t\t\tlet monitorData = deepCopy(this._monitorData);\n\t\t\t\tthis._monitorData = [];\n\n\t\t\t\tlet size = JSON.stringify(monitorData).replace(/[\\[\\]\\,\\\"]/g,'').length * 8;\n\n\t\t\t\tif (size < 45000000) { // 50 MB size limit\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst response = await post('/api/monitor', monitorData);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\tif (e.statusCode !== 500 && e.statusCode !== 501 && e.statusCode !== 502 && e.statusCode !== 503 && e.statusCode !== 504) {\n\t\t\t\t\t\t\tResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', 'RESOLVEIO MONITOR HTTP - Error Detected', JSON.stringify(e, null, 2));\n\n\t\t\t\t\t\t\tconsole.log(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet tmpData = [];\n\t\t\t\t\tfor (let i = 0; i < monitorData.length; i++) {\n\t\t\t\t\t\ttmpData.push(monitorData[i]);\n\t\t\t\t\t\tsize = JSON.stringify(tmpData).replace(/[\\[\\]\\,\\\"]/g,'').length * 8;\n\n\t\t\t\t\t\tif (size > 45000000) {\n\t\t\t\t\t\t\ttmpData.pop();\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst response = await post('/api/monitor', tmpData);\n\n\t\t\t\t\t\t\t\ttmpData = [monitorData[i]];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\t\t\tif (e.statusCode !== 500 && e.statusCode !== 501 && e.statusCode !== 502 && e.statusCode !== 503 && e.statusCode !== 504) {\n\t\t\t\t\t\t\t\t\tResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', 'RESOLVEIO MONITOR HTTP - Error Detected', JSON.stringify(e, null, 2));\n\t\t\n\t\t\t\t\t\t\t\t\tconsole.log(e);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (tmpData.length) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst response = await post('/api/monitor', tmpData);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\t\tif (e.statusCode !== 500 && e.statusCode !== 501 && e.statusCode !== 502 && e.statusCode !== 503 && e.statusCode !== 504) {\n\t\t\t\t\t\t\t\tResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', 'RESOLVEIO MONITOR HTTP - Error Detected', JSON.stringify(e, null, 2));\n\t\n\t\t\t\t\t\t\t\tconsole.log(e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.setupEventLoop();\n\t\t}, 60000);\n\t}\n}"]}
|
package/methods/monitor.js
CHANGED
|
@@ -39,8 +39,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.loadMonitorMethods = void 0;
|
|
40
40
|
var monitor_mongo_collection_1 = require("../collections/monitor-mongo.collection");
|
|
41
41
|
var monitor_cpu_collection_1 = require("../collections/monitor-cpu.collection");
|
|
42
|
-
var monitor_https_outbound_collection_1 = require("../collections/monitor-https-outbound.collection");
|
|
43
|
-
var monitor_https_inbound_collection_1 = require("../collections/monitor-https-inbound.collection");
|
|
44
42
|
var monitor_memory_collection_1 = require("../collections/monitor-memory.collection");
|
|
45
43
|
var __1 = require("..");
|
|
46
44
|
var common_1 = require("../util/common");
|
|
@@ -95,8 +93,8 @@ function loadMonitorMethods(methodManager) {
|
|
|
95
93
|
timezone: "America/Chicago"
|
|
96
94
|
}
|
|
97
95
|
},
|
|
98
|
-
client: '$client',
|
|
99
|
-
instance: '$instance'
|
|
96
|
+
client: '$metadata.client',
|
|
97
|
+
instance: '$metadata.instance'
|
|
100
98
|
};
|
|
101
99
|
groupDate = {
|
|
102
100
|
'year': '$_id.year',
|
|
@@ -139,8 +137,8 @@ function loadMonitorMethods(methodManager) {
|
|
|
139
137
|
timezone: "America/Chicago"
|
|
140
138
|
}
|
|
141
139
|
},
|
|
142
|
-
client: '$client',
|
|
143
|
-
instance: '$instance'
|
|
140
|
+
client: '$metadata.client',
|
|
141
|
+
instance: '$metadata.instance'
|
|
144
142
|
};
|
|
145
143
|
groupDate = {
|
|
146
144
|
'year': '$_id.year',
|
|
@@ -176,8 +174,8 @@ function loadMonitorMethods(methodManager) {
|
|
|
176
174
|
timezone: "America/Chicago"
|
|
177
175
|
}
|
|
178
176
|
},
|
|
179
|
-
client: '$client',
|
|
180
|
-
instance: '$instance'
|
|
177
|
+
client: '$metadata.client',
|
|
178
|
+
instance: '$metadata.instance'
|
|
181
179
|
};
|
|
182
180
|
groupDate = {
|
|
183
181
|
'year': '$_id.year',
|
|
@@ -206,8 +204,8 @@ function loadMonitorMethods(methodManager) {
|
|
|
206
204
|
timezone: "America/Chicago"
|
|
207
205
|
}
|
|
208
206
|
},
|
|
209
|
-
client: '$client',
|
|
210
|
-
instance: '$instance'
|
|
207
|
+
client: '$metadata.client',
|
|
208
|
+
instance: '$metadata.instance'
|
|
211
209
|
};
|
|
212
210
|
groupDate = {
|
|
213
211
|
'year': '$_id.year',
|
|
@@ -248,7 +246,7 @@ function loadMonitorMethods(methodManager) {
|
|
|
248
246
|
$group: {
|
|
249
247
|
_id: groupDate,
|
|
250
248
|
data: {
|
|
251
|
-
$push: { k: { $concat: ['$_id.client', ' - ',
|
|
249
|
+
$push: { k: { $concat: ['$_id.client', ' - ', '$_id.instance'] }, v: '$' + variable }
|
|
252
250
|
}
|
|
253
251
|
}
|
|
254
252
|
});
|
|
@@ -331,8 +329,8 @@ function loadMonitorMethods(methodManager) {
|
|
|
331
329
|
timezone: "America/Chicago"
|
|
332
330
|
}
|
|
333
331
|
},
|
|
334
|
-
client: '$client',
|
|
335
|
-
instance: '$instance'
|
|
332
|
+
client: '$metadata.client',
|
|
333
|
+
instance: '$metadata.instance'
|
|
336
334
|
};
|
|
337
335
|
groupDate = {
|
|
338
336
|
'year': '$_id.year',
|
|
@@ -375,8 +373,8 @@ function loadMonitorMethods(methodManager) {
|
|
|
375
373
|
timezone: "America/Chicago"
|
|
376
374
|
}
|
|
377
375
|
},
|
|
378
|
-
client: '$client',
|
|
379
|
-
instance: '$instance'
|
|
376
|
+
client: '$metadata.client',
|
|
377
|
+
instance: '$metadata.instance'
|
|
380
378
|
};
|
|
381
379
|
groupDate = {
|
|
382
380
|
'year': '$_id.year',
|
|
@@ -412,8 +410,8 @@ function loadMonitorMethods(methodManager) {
|
|
|
412
410
|
timezone: "America/Chicago"
|
|
413
411
|
}
|
|
414
412
|
},
|
|
415
|
-
client: '$client',
|
|
416
|
-
instance: '$instance'
|
|
413
|
+
client: '$metadata.client',
|
|
414
|
+
instance: '$metadata.instance'
|
|
417
415
|
};
|
|
418
416
|
groupDate = {
|
|
419
417
|
'year': '$_id.year',
|
|
@@ -442,8 +440,8 @@ function loadMonitorMethods(methodManager) {
|
|
|
442
440
|
timezone: "America/Chicago"
|
|
443
441
|
}
|
|
444
442
|
},
|
|
445
|
-
client: '$client',
|
|
446
|
-
instance: '$instance'
|
|
443
|
+
client: '$metadata.client',
|
|
444
|
+
instance: '$metadata.instance'
|
|
447
445
|
};
|
|
448
446
|
groupDate = {
|
|
449
447
|
'year': '$_id.year',
|
|
@@ -491,10 +489,10 @@ function loadMonitorMethods(methodManager) {
|
|
|
491
489
|
$first: '$date'
|
|
492
490
|
},
|
|
493
491
|
_a.client = {
|
|
494
|
-
$first: '$client'
|
|
492
|
+
$first: '$metadata.client'
|
|
495
493
|
},
|
|
496
494
|
_a.instance = {
|
|
497
|
-
$first: '$instance'
|
|
495
|
+
$first: '$metadata.instance'
|
|
498
496
|
},
|
|
499
497
|
_a)
|
|
500
498
|
});
|
|
@@ -615,17 +613,7 @@ function loadMonitorMethods(methodManager) {
|
|
|
615
613
|
function: function () {
|
|
616
614
|
return monitor_memory_collection_1.MonitorMemorys.find({}, { readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary' }, true);
|
|
617
615
|
}
|
|
618
|
-
}
|
|
619
|
-
monitorHTTPSOutbounds: {
|
|
620
|
-
function: function () {
|
|
621
|
-
return monitor_https_outbound_collection_1.MonitorHTTPSOutbounds.find({}, { readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary' }, true);
|
|
622
|
-
}
|
|
623
|
-
},
|
|
624
|
-
monitorHTTPSInbounds: {
|
|
625
|
-
function: function () {
|
|
626
|
-
return monitor_https_inbound_collection_1.MonitorHTTPSInbounds.find({}, { readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary' }, true);
|
|
627
|
-
}
|
|
628
|
-
},
|
|
616
|
+
}
|
|
629
617
|
});
|
|
630
618
|
}
|
|
631
619
|
exports.loadMonitorMethods = loadMonitorMethods;
|
package/methods/monitor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/methods/monitor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oFAAwE;AACxE,gFAAoE;AACpE,sGAAyF;AACzF,oGAAuF;AACvF,sFAA0E;AAC1E,wBAAqC;AACrC,yCAA0C;AAE1C,SAAgB,kBAAkB,CAAC,aAA4B;IAC9D,aAAa,CAAC,OAAO,CAAC;QACf,0BAA0B,EAAE;YACxB,QAAQ,EAAE,UAAS,UAAgB,EAAE,QAAc,EAAE,UAAkB,EAAE,QAAgB,EAAE,MAAc,EAAE,aAAqB,EAAE,QAAgB,EAAE,YAAoB;gBAA9J,iBAuPlB;gBAtPA,OAAO,IAAI,OAAO,CAAC,UAAO,OAAO,EAAE,MAAM;;;;;;gCACpC,OAAO,GAAG,EAAE,CAAC;gCACb,SAAS,GAAG,EAAE,CAAC;gCAEnB,IAAI,aAAa,KAAK,SAAS,EAAE;oCAChC,OAAO,GAAG;wCACT,MAAM,EAAE;4CACP,OAAO,EAAE;gDACR,IAAI,EAAE,OAAO;gDACb,QAAQ,EAAE,iBAAiB;6CAC3B;yCACD;wCACD,MAAM,EAAE;4CACP,OAAO,EAAE;gDACR,IAAI,EAAE,OAAO;gDACb,QAAQ,EAAE,iBAAiB;6CAC3B;yCACD;wCACD,IAAI,EAAE;4CACL,KAAK,EAAE;gDACN,IAAI,EAAE,OAAO;gDACb,QAAQ,EAAE,iBAAiB;6CAC3B;yCACD;wCACD,GAAG,EAAE;4CACJ,WAAW,EAAE;gDACZ,IAAI,EAAE,OAAO;gDACb,QAAQ,EAAE,iBAAiB;6CAC3B;yCACD;wCACD,KAAK,EAAE;4CACN,MAAM,EAAE;gDACP,IAAI,EAAE,OAAO;gDACb,QAAQ,EAAE,iBAAiB;6CAC3B;yCACD;wCACD,IAAI,EAAE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,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,CAAC;YAC7I,CAAC;SACJ;QACD,cAAc,EAAE;YACZ,QAAQ,EAAE;gBACN,OAAO,0CAAc,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,CAAC;YAChJ,CAAC;SACJ;QACD,qBAAqB,EAAE;YACnB,QAAQ,EAAE;gBACN,OAAO,yDAAqB,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,CAAC;YACvJ,CAAC;SACJ;QACD,oBAAoB,EAAE;YAClB,QAAQ,EAAE;gBACN,OAAO,uDAAoB,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,CAAC;YACtJ,CAAC;SACJ;KACP,CAAC,CAAC;AACJ,CAAC;AAlmBD,gDAkmBC","file":"monitor.js","sourcesContent":["import { MethodManager } from '../managers/method.manager';\nimport { MonitorMongos } from '../collections/monitor-mongo.collection';\nimport { MonitorCPUs } from '../collections/monitor-cpu.collection';\nimport { MonitorHTTPSOutbounds } from '../collections/monitor-https-outbound.collection';\nimport { MonitorHTTPSInbounds } from '../collections/monitor-https-inbound.collection';\nimport { MonitorMemorys } from '../collections/monitor-memory.collection';\nimport { ResolveIOServer } from '..';\nimport { deepCopy } from '../util/common';\n\nexport function loadMonitorMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n superadminMonitorGraphData: {\n function: function(date_start: Date, date_end: Date, collection: string, instance: string, client: string, graphInterval: string, variable: string, variableType: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet groupId = {};\n\t\t\t\t\tlet groupDate = {};\n\n\t\t\t\t\tif (graphInterval === 'seconds') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tsecond: {\n\t\t\t\t\t\t\t\t$second: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$client',\n instance: '$instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute',\n\t\t\t\t\t\t\t'second': '$_id.second'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'minutes') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$client',\n instance: '$instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'hours') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$client',\n instance: '$instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$client',\n instance: '$instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day'\n\t\t\t\t\t\t};\n }\n\n let query = <any>[\n {\n $match: {\n $and: [\n {\n date: {$gte: date_start}\n },\n {\n date: {$lte: date_end}\n }\n ]\n }\n }\n ];\n\n if (client) {\n query[0]['$match'].$and.push({client: client});\n }\n\n if (instance) {\n query[0]['$match'].$and.push({instance: instance});\n\t\t\t\t\t}\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t\t[variable]: variableType === 'count' ? {$sum: 1} : {\n\t\t\t\t\t\t\t\t\t['$' + variableType]: '$' + variable\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupDate,\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t$push: {k: {$concat: ['$_id.client', ' - ', {$replaceAll: { input: '$_id.instance', find: \".\", replacement: \"-\" }}]}, v: '$' + variable}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$addFields: {\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t$arrayToObject: '$data'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$replaceRoot: {\n\t\t\t\t\t\t\t\tnewRoot: {\n\t\t\t\t\t\t\t\t\t$mergeObjects: ['$data', '$$ROOT']\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$project: {\n\t\t\t\t\t\t\t\tdata: 0\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\t// console.log(JSON.stringify(query, null, 2));\n\n\t\t\t\t\tlet graphData = await ResolveIOServer.getMongoManager().collection(collection).aggregate(query, {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tresolve(graphData);\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n },\n\t\tsuperadminMonitorTableData: {\n function: function(date_start: Date, date_end: Date, collection: string, instance: string, client: string, graphInterval: string, variable: string, variableType: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet groupId = {};\n\t\t\t\t\tlet groupDate = {};\n\n\t\t\t\t\tif (graphInterval === 'seconds') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tsecond: {\n\t\t\t\t\t\t\t\t$second: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$client',\n instance: '$instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute',\n\t\t\t\t\t\t\t'second': '$_id.second'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'minutes') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$client',\n instance: '$instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'hours') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$client',\n instance: '$instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$client',\n instance: '$instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day'\n\t\t\t\t\t\t};\n }\n\n let query = <any>[\n {\n $match: {\n $and: [\n {\n date: {$gte: date_start}\n },\n {\n date: {$lte: date_end}\n }\n ]\n }\n }\n ];\n\n if (client) {\n query[0]['$match'].$and.push({client: client});\n }\n\n if (instance) {\n query[0]['$match'].$and.push({instance: instance});\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlet firstGroupId = deepCopy(groupId);\n\t\t\t\t\t\n\t\t\t\t\tif (collection === 'monitor-mongos') {\n\t\t\t\t\t\tfirstGroupId[variable] = '$' + variable;\n\t\t\t\t\t\tgroupDate[variable] = '$' + variable;\n\t\t\t\t\t\tgroupDate['date'] = '$date';\n\t\t\t\t\t\tgroupDate['data'] = '$data';\n\t\t\t\t\t\t\n\t\t\t\t\t\tquery.push(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t\t_id: firstGroupId,\n\t\t\t\t\t\t\t\t\t[variable]: {\n\t\t\t\t\t\t\t\t\t\t'$sum': 1\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t[variable + '_name']: {\n\t\t\t\t\t\t\t\t\t\t$first: '$' + [variable]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tdate: {\n\t\t\t\t\t\t\t\t\t\t$first: '$date'\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tclient: {\n\t\t\t\t\t\t\t\t\t\t$first: '$client'\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tinstance: {\n\t\t\t\t\t\t\t\t\t\t$first: '$instance'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tquery.push({\n\t\t\t\t\t\t\t$addFields: {\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t[variable]: '$' + variable,\n\t\t\t\t\t\t\t\t\t[variable + '_name']: '$' + variable + '_name'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tquery.push({\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t\t[variable]: {\n\t\t\t\t\t\t\t\t\t'$sum': '$data.' + variable\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdate: {\n\t\t\t\t\t\t\t\t\t$first: '$date'\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t$push: '$data'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\n\t\t\t\t\t\tquery.push({\n\t\t\t\t\t\t\t$addFields: {\n\t\t\t\t\t\t\t\t[variable]: groupDate\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tquery.push(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t\t_id: {\n\t\t\t\t\t\t\t\t\t\tclient: '$_id.client',\n\t\t\t\t\t\t\t\t\t\tinstance: '$_id.instance'\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t\t$push: '$' + variable\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t[variable]: {\n\t\t\t\t\t\t\t\t\t\t$sum: '$' + variable + '.' + variable\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// query.push(\n\t\t\t\t\t\t// \t{\n\t\t\t\t\t\t// \t\t$group: {\n\t\t\t\t\t\t// \t\t\t_id: groupId,\n\t\t\t\t\t\t// \t\t\t[variable]: {\n\t\t\t\t\t\t// \t\t\t\t['$' + variableType]: '$' + variable\n\t\t\t\t\t\t// \t\t\t}\n\t\t\t\t\t\t// \t\t}\n\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t// );\n\n\t\t\t\t\t\t// query.push(\n\t\t\t\t\t\t// \t{\n\t\t\t\t\t\t// \t\t$group: {\n\t\t\t\t\t\t// \t\t\t_id: groupDate,\n\t\t\t\t\t\t// \t\t\tdata: {\n\t\t\t\t\t\t// \t\t\t\t$push: {k: {$concat: ['$_id.client', ' - ', {$replaceAll: { input: '$_id.instance', find: \".\", replacement: \"-\" }}]}, v: '$' + variable}\n\t\t\t\t\t\t// \t\t\t}\n\t\t\t\t\t\t// \t\t}\n\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t// );\n\n\t\t\t\t\t\t// query.push(\n\t\t\t\t\t\t// \t{\n\t\t\t\t\t\t// \t\t$addFields: {\n\t\t\t\t\t\t// \t\t\tdata: {\n\t\t\t\t\t\t// \t\t\t\t$arrayToObject: '$data'\n\t\t\t\t\t\t// \t\t\t}\n\t\t\t\t\t\t// \t\t}\n\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t// );\n\n\t\t\t\t\t\t// query.push(\n\t\t\t\t\t\t// \t{\n\t\t\t\t\t\t// \t\t$replaceRoot: {\n\t\t\t\t\t\t// \t\t\tnewRoot: {\n\t\t\t\t\t\t// \t\t\t\t$mergeObjects: ['$data', '$$ROOT']\n\t\t\t\t\t\t// \t\t\t}\n\t\t\t\t\t\t// \t\t}\n\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t// );\n\n\t\t\t\t\t\t// query.push(\n\t\t\t\t\t\t// \t{\n\t\t\t\t\t\t// \t\t$project: {\n\t\t\t\t\t\t// \t\t\tdata: 0\n\t\t\t\t\t\t// \t\t}\n\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t// );\n\t\t\t\t\t}\n\n\t\t\t\t\tconsole.log(JSON.stringify(query, null, 2));\n\n\t\t\t\t\tlet graphData = await ResolveIOServer.getMongoManager().collection(collection).aggregate(query, {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tresolve(graphData);\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n },\n monitorMongos: {\n function: function() {\n return MonitorMongos.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n },\n monitorCPUs: {\n function: function() {\n return MonitorCPUs.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n },\n monitorMemorys: {\n function: function() {\n return MonitorMemorys.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n },\n monitorHTTPSOutbounds: {\n function: function() {\n return MonitorHTTPSOutbounds.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n },\n monitorHTTPSInbounds: {\n function: function() {\n return MonitorHTTPSInbounds.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n },\n\t});\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/methods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,YAAY,CAAC,UAAU,CAAC,KAAK,uBAAuB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC,EAAE,IAAI,CAAC,CAAC;YAChJ,CAAC;SACJ;KACP,CAAC,CAAC;AACJ,CAAC;AAxlBD,gDAwlBC","file":"monitor.js","sourcesContent":["import { MethodManager } from '../managers/method.manager';\nimport { MonitorMongos } from '../collections/monitor-mongo.collection';\nimport { MonitorCPUs } from '../collections/monitor-cpu.collection';\nimport { MonitorMemorys } from '../collections/monitor-memory.collection';\nimport { ResolveIOServer } from '..';\nimport { deepCopy } from '../util/common';\n\nexport function loadMonitorMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n superadminMonitorGraphData: {\n function: function(date_start: Date, date_end: Date, collection: string, instance: string, client: string, graphInterval: string, variable: string, variableType: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet groupId = {};\n\t\t\t\t\tlet groupDate = {};\n\n\t\t\t\t\tif (graphInterval === 'seconds') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tsecond: {\n\t\t\t\t\t\t\t\t$second: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute',\n\t\t\t\t\t\t\t'second': '$_id.second'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'minutes') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'hours') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day'\n\t\t\t\t\t\t};\n }\n\n let query = <any>[\n {\n $match: {\n $and: [\n {\n date: {$gte: date_start}\n },\n {\n date: {$lte: date_end}\n }\n ]\n }\n }\n ];\n\n if (client) {\n query[0]['$match'].$and.push({client: client});\n }\n\n if (instance) {\n query[0]['$match'].$and.push({instance: instance});\n\t\t\t\t\t}\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t\t[variable]: variableType === 'count' ? {$sum: 1} : {\n\t\t\t\t\t\t\t\t\t['$' + variableType]: '$' + variable\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupDate,\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t$push: {k: {$concat: ['$_id.client', ' - ', '$_id.instance']}, v: '$' + variable}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$addFields: {\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t$arrayToObject: '$data'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$replaceRoot: {\n\t\t\t\t\t\t\t\tnewRoot: {\n\t\t\t\t\t\t\t\t\t$mergeObjects: ['$data', '$$ROOT']\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tquery.push(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$project: {\n\t\t\t\t\t\t\t\tdata: 0\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\t// console.log(JSON.stringify(query, null, 2));\n\n\t\t\t\t\tlet graphData = await ResolveIOServer.getMongoManager().collection(collection).aggregate(query, {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tresolve(graphData);\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n },\n\t\tsuperadminMonitorTableData: {\n function: function(date_start: Date, date_end: Date, collection: string, instance: string, client: string, graphInterval: string, variable: string, variableType: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet groupId = {};\n\t\t\t\t\tlet groupDate = {};\n\n\t\t\t\t\tif (graphInterval === 'seconds') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tsecond: {\n\t\t\t\t\t\t\t\t$second: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute',\n\t\t\t\t\t\t\t'second': '$_id.second'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'minutes') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tminute: {\n\t\t\t\t\t\t\t\t$minute: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour',\n\t\t\t\t\t\t\t'minute': '$_id.minute'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse if (graphInterval === 'hours') {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\thour: {\n\t\t\t\t\t\t\t\t$hour: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day',\n\t\t\t\t\t\t\t'hour': '$_id.hour'\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tgroupId = {\n\t\t\t\t\t\t\tday: {\n\t\t\t\t\t\t\t\t$dayOfMonth: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmonth: {\n\t\t\t\t\t\t\t\t$month: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyear: {\n\t\t\t\t\t\t\t\t$year: {\n\t\t\t\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t\t\t\t\ttimezone: \"America/Chicago\"\n\t\t\t\t\t\t\t\t} \n },\n client: '$metadata.client',\n instance: '$metadata.instance'\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tgroupDate = {\n\t\t\t\t\t\t\t'year': '$_id.year',\n\t\t\t\t\t\t\t'month': '$_id.month',\n\t\t\t\t\t\t\t'day': '$_id.day'\n\t\t\t\t\t\t};\n }\n\n let query = <any>[\n {\n $match: {\n $and: [\n {\n date: {$gte: date_start}\n },\n {\n date: {$lte: date_end}\n }\n ]\n }\n }\n ];\n\n if (client) {\n query[0]['$match'].$and.push({client: client});\n }\n\n if (instance) {\n query[0]['$match'].$and.push({instance: instance});\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlet firstGroupId = deepCopy(groupId);\n\t\t\t\t\t\n\t\t\t\t\tif (collection === 'monitor-mongos') {\n\t\t\t\t\t\tfirstGroupId[variable] = '$' + variable;\n\t\t\t\t\t\tgroupDate[variable] = '$' + variable;\n\t\t\t\t\t\tgroupDate['date'] = '$date';\n\t\t\t\t\t\tgroupDate['data'] = '$data';\n\t\t\t\t\t\t\n\t\t\t\t\t\tquery.push(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t\t_id: firstGroupId,\n\t\t\t\t\t\t\t\t\t[variable]: {\n\t\t\t\t\t\t\t\t\t\t'$sum': 1\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t[variable + '_name']: {\n\t\t\t\t\t\t\t\t\t\t$first: '$' + [variable]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tdate: {\n\t\t\t\t\t\t\t\t\t\t$first: '$date'\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tclient: {\n\t\t\t\t\t\t\t\t\t\t$first: '$metadata.client'\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tinstance: {\n\t\t\t\t\t\t\t\t\t\t$first: '$metadata.instance'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tquery.push({\n\t\t\t\t\t\t\t$addFields: {\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t[variable]: '$' + variable,\n\t\t\t\t\t\t\t\t\t[variable + '_name']: '$' + variable + '_name'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tquery.push({\n\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t_id: groupId,\n\t\t\t\t\t\t\t\t[variable]: {\n\t\t\t\t\t\t\t\t\t'$sum': '$data.' + variable\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdate: {\n\t\t\t\t\t\t\t\t\t$first: '$date'\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t$push: '$data'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\n\t\t\t\t\t\tquery.push({\n\t\t\t\t\t\t\t$addFields: {\n\t\t\t\t\t\t\t\t[variable]: groupDate\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tquery.push(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$group: {\n\t\t\t\t\t\t\t\t\t_id: {\n\t\t\t\t\t\t\t\t\t\tclient: '$_id.client',\n\t\t\t\t\t\t\t\t\t\tinstance: '$_id.instance'\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t\t$push: '$' + variable\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t[variable]: {\n\t\t\t\t\t\t\t\t\t\t$sum: '$' + variable + '.' + variable\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// query.push(\n\t\t\t\t\t\t// \t{\n\t\t\t\t\t\t// \t\t$group: {\n\t\t\t\t\t\t// \t\t\t_id: groupId,\n\t\t\t\t\t\t// \t\t\t[variable]: {\n\t\t\t\t\t\t// \t\t\t\t['$' + variableType]: '$' + variable\n\t\t\t\t\t\t// \t\t\t}\n\t\t\t\t\t\t// \t\t}\n\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t// );\n\n\t\t\t\t\t\t// query.push(\n\t\t\t\t\t\t// \t{\n\t\t\t\t\t\t// \t\t$group: {\n\t\t\t\t\t\t// \t\t\t_id: groupDate,\n\t\t\t\t\t\t// \t\t\tdata: {\n\t\t\t\t\t\t// \t\t\t\t$push: {k: {$concat: ['$_id.client', ' - ', {$replaceAll: { input: '$_id.instance', find: \".\", replacement: \"-\" }}]}, v: '$' + variable}\n\t\t\t\t\t\t// \t\t\t}\n\t\t\t\t\t\t// \t\t}\n\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t// );\n\n\t\t\t\t\t\t// query.push(\n\t\t\t\t\t\t// \t{\n\t\t\t\t\t\t// \t\t$addFields: {\n\t\t\t\t\t\t// \t\t\tdata: {\n\t\t\t\t\t\t// \t\t\t\t$arrayToObject: '$data'\n\t\t\t\t\t\t// \t\t\t}\n\t\t\t\t\t\t// \t\t}\n\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t// );\n\n\t\t\t\t\t\t// query.push(\n\t\t\t\t\t\t// \t{\n\t\t\t\t\t\t// \t\t$replaceRoot: {\n\t\t\t\t\t\t// \t\t\tnewRoot: {\n\t\t\t\t\t\t// \t\t\t\t$mergeObjects: ['$data', '$$ROOT']\n\t\t\t\t\t\t// \t\t\t}\n\t\t\t\t\t\t// \t\t}\n\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t// );\n\n\t\t\t\t\t\t// query.push(\n\t\t\t\t\t\t// \t{\n\t\t\t\t\t\t// \t\t$project: {\n\t\t\t\t\t\t// \t\t\tdata: 0\n\t\t\t\t\t\t// \t\t}\n\t\t\t\t\t\t// \t}\n\t\t\t\t\t\t// );\n\t\t\t\t\t}\n\n\t\t\t\t\tconsole.log(JSON.stringify(query, null, 2));\n\n\t\t\t\t\tlet graphData = await ResolveIOServer.getMongoManager().collection(collection).aggregate(query, {allowDiskUse: true, readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n\n\t\t\t\t\tresolve(graphData);\n\t\t\t\t});\n\t\t\t},\n\t\t\tskipValidation: true\n },\n monitorMongos: {\n function: function() {\n return MonitorMongos.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n },\n monitorCPUs: {\n function: function() {\n return MonitorCPUs.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n },\n monitorMemorys: {\n function: function() {\n return MonitorMemorys.find({}, {readPreference: this.serverConfig['ROOT_URL'] !== 'http://localhost:4200' ? 'secondary' : 'primary'}, true);\n }\n }\n\t});\n}"]}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { CollectionDocument } from './collection-document.model';
|
|
2
2
|
export interface MonitorCPUModel extends CollectionDocument {
|
|
3
|
-
|
|
4
|
-
client: string;
|
|
3
|
+
metadata: MonitorCPUMetadataModel;
|
|
5
4
|
date: Date;
|
|
6
5
|
app: number;
|
|
7
6
|
system: number;
|
|
8
7
|
}
|
|
8
|
+
export interface MonitorCPUMetadataModel {
|
|
9
|
+
client: string;
|
|
10
|
+
instance: string;
|
|
11
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/monitor-cpu.model.ts"],"names":[],"mappings":"","file":"monitor-cpu.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport interface MonitorCPUModel extends CollectionDocument {\n\
|
|
1
|
+
{"version":3,"sources":["../../src/models/monitor-cpu.model.ts"],"names":[],"mappings":"","file":"monitor-cpu.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport interface MonitorCPUModel extends CollectionDocument {\n\tmetadata: MonitorCPUMetadataModel;\n\tdate: Date;\n\tapp: number;\n\tsystem: number;\n}\n\nexport interface MonitorCPUMetadataModel {\n\tclient: string;\n\tinstance: string;\n}"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CollectionDocument } from './collection-document.model';
|
|
2
2
|
export interface MonitorMemoryModel extends CollectionDocument {
|
|
3
|
-
|
|
4
|
-
client: string;
|
|
3
|
+
metadata: MonitorMemoryMetadataModel;
|
|
5
4
|
date: Date;
|
|
6
5
|
physical_total: number;
|
|
7
6
|
physical_used: number;
|
|
@@ -10,3 +9,7 @@ export interface MonitorMemoryModel extends CollectionDocument {
|
|
|
10
9
|
private: number;
|
|
11
10
|
physical: number;
|
|
12
11
|
}
|
|
12
|
+
export interface MonitorMemoryMetadataModel {
|
|
13
|
+
client: string;
|
|
14
|
+
instance: string;
|
|
15
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/monitor-memory.model.ts"],"names":[],"mappings":"","file":"monitor-memory.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport interface MonitorMemoryModel extends CollectionDocument {\n\
|
|
1
|
+
{"version":3,"sources":["../../src/models/monitor-memory.model.ts"],"names":[],"mappings":"","file":"monitor-memory.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport interface MonitorMemoryModel extends CollectionDocument {\n\tmetadata: MonitorMemoryMetadataModel;\n\tdate: Date;\n\tphysical_total: number;\n\tphysical_used: number;\n\tphysical_free: number;\n\tvirtual: number;\n\tprivate: number;\n\tphysical: number;\n}\n\nexport interface MonitorMemoryMetadataModel {\n\tclient: string;\n\tinstance: string;\n}"]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { CollectionDocument } from './collection-document.model';
|
|
2
2
|
export interface MonitorMongoModel extends CollectionDocument {
|
|
3
|
-
|
|
4
|
-
client: string;
|
|
3
|
+
metadata: MonitorMongoMetadataModel;
|
|
5
4
|
date: Date;
|
|
6
5
|
method: string;
|
|
7
6
|
doc_collection: string;
|
|
8
7
|
duration: number;
|
|
9
8
|
query: string;
|
|
10
9
|
}
|
|
10
|
+
export interface MonitorMongoMetadataModel {
|
|
11
|
+
client: string;
|
|
12
|
+
instance: string;
|
|
13
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/monitor-mongo.model.ts"],"names":[],"mappings":"","file":"monitor-mongo.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport interface MonitorMongoModel extends CollectionDocument {\n\
|
|
1
|
+
{"version":3,"sources":["../../src/models/monitor-mongo.model.ts"],"names":[],"mappings":"","file":"monitor-mongo.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport interface MonitorMongoModel extends CollectionDocument {\n\tmetadata: MonitorMongoMetadataModel;\n\tdate: Date;\n\tmethod: string;\n\tdoc_collection: string;\n\tduration: number;\n\tquery: string;\n}\n\nexport interface MonitorMongoMetadataModel {\n\tclient: string;\n\tinstance: string;\n}"]}
|