@resolveio/server-lib 8.1.0 → 8.1.2
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/report-builder-dashboard-builder.collection.d.ts +7 -0
- package/collections/report-builder-dashboard-builder.collection.js +102 -0
- package/collections/report-builder-dashboard-builder.collection.js.map +1 -0
- package/managers/monitor.manager.js +1 -1
- package/managers/monitor.manager.js.map +1 -1
- package/models/report-builder-dashboard-builder.model.d.ts +17 -0
- package/models/report-builder-dashboard-builder.model.js +4 -0
- package/models/report-builder-dashboard-builder.model.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Model, Document } from 'mongoose';
|
|
2
|
+
import { ReportBuilderReportModel } from '../models/report-builder-report.model';
|
|
3
|
+
interface ResolveIOModel extends ReportBuilderReportModel, Document {
|
|
4
|
+
}
|
|
5
|
+
export declare let ReportBuilderReports: Model<ResolveIOModel>;
|
|
6
|
+
export declare let ReportBuilderReportVersions: Model<ResolveIOModel>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.ReportBuilderReportVersions = exports.ReportBuilderReports = void 0;
|
|
15
|
+
var mongoose_1 = require("mongoose");
|
|
16
|
+
var simpl_schema_1 = require("simpl-schema");
|
|
17
|
+
var index_1 = require("../index");
|
|
18
|
+
var schema = {
|
|
19
|
+
_id: {
|
|
20
|
+
type: String,
|
|
21
|
+
optional: true
|
|
22
|
+
},
|
|
23
|
+
__v: {
|
|
24
|
+
type: Number,
|
|
25
|
+
optional: true
|
|
26
|
+
},
|
|
27
|
+
updatedAt: {
|
|
28
|
+
type: Date,
|
|
29
|
+
optional: true
|
|
30
|
+
},
|
|
31
|
+
createdAt: {
|
|
32
|
+
type: Date,
|
|
33
|
+
optional: true
|
|
34
|
+
},
|
|
35
|
+
name: {
|
|
36
|
+
type: String
|
|
37
|
+
},
|
|
38
|
+
date_created: {
|
|
39
|
+
type: Date
|
|
40
|
+
},
|
|
41
|
+
user_created: {
|
|
42
|
+
type: String
|
|
43
|
+
},
|
|
44
|
+
num_rows: {
|
|
45
|
+
type: Number
|
|
46
|
+
},
|
|
47
|
+
num_columns: {
|
|
48
|
+
type: Number
|
|
49
|
+
},
|
|
50
|
+
reports: {
|
|
51
|
+
type: Array
|
|
52
|
+
},
|
|
53
|
+
'reports.$': {
|
|
54
|
+
type: Object
|
|
55
|
+
},
|
|
56
|
+
'reports.$.id_report': {
|
|
57
|
+
type: String
|
|
58
|
+
},
|
|
59
|
+
'reports.$.report_name': {
|
|
60
|
+
type: String
|
|
61
|
+
},
|
|
62
|
+
'reports.$.report_type': {
|
|
63
|
+
type: String
|
|
64
|
+
},
|
|
65
|
+
'reports.$.display_type': {
|
|
66
|
+
type: String
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var DefaultSchema = new mongoose_1.Schema(schema, {
|
|
70
|
+
skipVersioning: true,
|
|
71
|
+
versionKey: false,
|
|
72
|
+
timestamps: true
|
|
73
|
+
});
|
|
74
|
+
DefaultSchema.index({ name: 1 });
|
|
75
|
+
DefaultSchema.index({ date_created: 1 });
|
|
76
|
+
exports.ReportBuilderReports = null;
|
|
77
|
+
exports.ReportBuilderReportVersions = null;
|
|
78
|
+
initializeCollection();
|
|
79
|
+
function initializeCollection() {
|
|
80
|
+
if (index_1.ResolveIOServer.getMainDB()) {
|
|
81
|
+
exports.ReportBuilderReports = index_1.ResolveIOServer.getMainDB().model('report-builder-dashboard-builders', DefaultSchema);
|
|
82
|
+
var vSchema = __assign({}, schema);
|
|
83
|
+
vSchema._id = {
|
|
84
|
+
type: mongoose_1.Schema.Types.Mixed
|
|
85
|
+
};
|
|
86
|
+
var VersionSchema = new mongoose_1.Schema(vSchema, {
|
|
87
|
+
skipVersioning: true,
|
|
88
|
+
versionKey: false,
|
|
89
|
+
timestamps: true
|
|
90
|
+
});
|
|
91
|
+
exports.ReportBuilderReports['versionCollection'] = 'report-builder-dashboard-builders.versions';
|
|
92
|
+
exports.ReportBuilderReportVersions = index_1.ResolveIOServer.getMainDB().model(exports.ReportBuilderReports['versionCollection'], VersionSchema);
|
|
93
|
+
exports.ReportBuilderReports['simplschema'] = new simpl_schema_1.default(schema);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
setTimeout(function () {
|
|
97
|
+
initializeCollection();
|
|
98
|
+
}, 0);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
//# sourceMappingURL=report-builder-dashboard-builder.collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/collections/report-builder-dashboard-builder.collection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAAmD;AACnD,6CAAwC;AACxC,kCAA2C;AAG3C,IAAI,MAAM,GAAQ;IACjB,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACd;IACD,IAAI,EAAE;QACL,IAAI,EAAE,MAAM;KACZ;IACD,YAAY,EAAE;QACb,IAAI,EA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ACpB,UAAU,EAAE,KAAK;YACjB,UAAU,EAAE,IAAI;SAChB,CAAC,CAAC;QAEH,4BAAoB,CAAC,mBAAmB,CAAC,GAAG,4CAA4C,CAAC;QAEzF,mCAA2B,GAAG,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,4BAAoB,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC;QAE1H,4BAAoB,CAAC,aAAa,CAAC,GAAG,IAAI,sBAAY,CAAC,MAAM,CAAC,CAAC;KAC/D;SACI;QACJ,UAAU,CAAC;YACV,oBAAoB,EAAE,CAAC;QACxB,CAAC,EAAE,CAAC,CAAC,CAAC;KACN;AACF,CAAC","file":"report-builder-dashboard-builder.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { ReportBuilderReportModel } from '../models/report-builder-report.model';\n\nlet schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t__v: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tupdatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tname: {\n\t\ttype: String\n\t},\n\tdate_created: {\n\t\ttype: Date\n\t},\n\tuser_created: {\n\t\ttype: String\n\t},\n\tnum_rows: {\n\t\ttype: Number\n\t},\n\tnum_columns: {\n\t\ttype: Number\n\t},\n\treports: {\n\t\ttype: Array\n\t},\n\t'reports.$': {\n\t\ttype: Object\n\t},\n\t'reports.$.id_report': {\n\t\ttype: String\n\t},\n\t'reports.$.report_name': {\n\t\ttype: String\n\t},\n\t'reports.$.report_type': {\n\t\ttype: String\n\t},\n\t'reports.$.display_type': {\n\t\ttype: String\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.index({name: 1});\nDefaultSchema.index({date_created: 1});\n\ninterface ResolveIOModel extends ReportBuilderReportModel, Document {}\n\nexport let ReportBuilderReports: Model<ResolveIOModel> = null;\nexport let ReportBuilderReportVersions: Model<ResolveIOModel> = null;\n\ninitializeCollection();\n\nfunction initializeCollection() {\n\tif (ResolveIOServer.getMainDB()) {\n\t\tReportBuilderReports = ResolveIOServer.getMainDB().model('report-builder-dashboard-builders', DefaultSchema);\n\n\t\tlet vSchema = { ...schema };\n\t\tvSchema._id = {\n\t\t\ttype: Schema.Types.Mixed\n\t\t};\n\n\t\tlet VersionSchema = new Schema(vSchema, {\n\t\t\tskipVersioning: true,\n\t\t\tversionKey: false,\n\t\t\ttimestamps: true\n\t\t});\n\n\t\tReportBuilderReports['versionCollection'] = 'report-builder-dashboard-builders.versions';\n\n\t\tReportBuilderReportVersions = ResolveIOServer.getMainDB().model(ReportBuilderReports['versionCollection'], VersionSchema);\n\n\t\tReportBuilderReports['simplschema'] = new SimpleSchema(schema);\n\t}\n\telse {\n\t\tsetTimeout(() => {\n\t\t\tinitializeCollection();\n\t\t}, 0);\n\t}\n}"]}
|
|
@@ -268,7 +268,7 @@ var MonitorManager = /** @class */ (function () {
|
|
|
268
268
|
return [3 /*break*/, 4];
|
|
269
269
|
case 3:
|
|
270
270
|
e_1 = _a.sent();
|
|
271
|
-
if (e_1.statusCode !== 502 && e_1.statusCode !== 504) {
|
|
271
|
+
if (e_1.statusCode !== 500 && e_1.statusCode !== 502 && e_1.statusCode !== 504) {
|
|
272
272
|
index_1.ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', 'RESOLVEIO MONITOR HTTP - Error Detected', JSON.stringify(e_1, null, 2));
|
|
273
273
|
console.log(e_1);
|
|
274
274
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/managers/monitor.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2BAA6B;AAC7B,qCAAiC;AACjC,gFAAoE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AS,CAAC,GAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;4BAEzJ,OAAO,CAAC,GAAG,CAAC,GAAC,CAAC,CAAC;yBACf;;;wBAIH,IAAI,CAAC,cAAc,EAAE,CAAC;;;;aACtB,EAAE,KAAK,CAAC,CAAC;IACX,CAAC;IACF,qBAAC;AAAD,CAhOA,AAgOC,IAAA;AAhOY,wCAAc","file":"monitor.manager.js","sourcesContent":["import ResolveIOMainServer from '../server-app';\nimport * as bent from 'bent';\nimport { Types } from 'mongoose';\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';\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') {\n\t\t\t\tMonitorCPUs.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\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') {\n\t\t\t\tMonitorMemorys.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\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') {\n\t\t\t\tMonitorHTTPSInbounds.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\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') {\n\t\t\t\tMonitorHTTPSOutbounds.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\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') {\n\t\t\t\tif (!data.collection.startsWith('monitor-')) {\n\t\t\t\t\tMonitorMongos.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\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\t// this._monitorAgent.on('socket', async (data) => {\n\t\t// \tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\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\ttry {\n\t\t\t\t\tconst response = await post('/api/monitor', monitorData);\n\t\t\t\t}\n\t\t\t\tcatch (e) {\n\t\t\t\t\tif (e.statusCode !== 502 && e.statusCode !== 504) {\n\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\tconsole.log(e);\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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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;;;wBAIH,IAAI,CAAC,cAAc,EAAE,CAAC;;;;aACtB,EAAE,KAAK,CAAC,CAAC;IACX,CAAC;IACF,qBAAC;AAAD,CAhOA,AAgOC,IAAA;AAhOY,wCAAc","file":"monitor.manager.js","sourcesContent":["import ResolveIOMainServer from '../server-app';\nimport * as bent from 'bent';\nimport { Types } from 'mongoose';\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';\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') {\n\t\t\t\tMonitorCPUs.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\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') {\n\t\t\t\tMonitorMemorys.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\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') {\n\t\t\t\tMonitorHTTPSInbounds.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\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') {\n\t\t\t\tMonitorHTTPSOutbounds.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\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') {\n\t\t\t\tif (!data.collection.startsWith('monitor-')) {\n\t\t\t\t\tMonitorMongos.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\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\t// this._monitorAgent.on('socket', async (data) => {\n\t\t// \tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\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\ttry {\n\t\t\t\t\tconst response = await post('/api/monitor', monitorData);\n\t\t\t\t}\n\t\t\t\tcatch (e) {\n\t\t\t\t\tif (e.statusCode !== 500 && e.statusCode !== 502 && e.statusCode !== 504) {\n\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\tconsole.log(e);\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}"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CollectionDocument } from './collection-document.model';
|
|
2
|
+
import { ReportBuilderReportType } from './report-builder-report.model';
|
|
3
|
+
export interface ReportBuilderDashboardBuilder extends CollectionDocument {
|
|
4
|
+
name: string;
|
|
5
|
+
date_created: Date;
|
|
6
|
+
user_created: string;
|
|
7
|
+
num_rows: number;
|
|
8
|
+
num_columns: number;
|
|
9
|
+
reports: ReportBuilderDashboardBuilderReportModel[];
|
|
10
|
+
}
|
|
11
|
+
export interface ReportBuilderDashboardBuilderReportModel {
|
|
12
|
+
id_report: string;
|
|
13
|
+
report_name: string;
|
|
14
|
+
report_type: ReportBuilderReportType;
|
|
15
|
+
display_type: ReportBuilderDashboardBuilderReportDisplayType;
|
|
16
|
+
}
|
|
17
|
+
export declare type ReportBuilderDashboardBuilderReportDisplayType = 'Data' | 'Bar' | 'Line' | 'Pie';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/models/report-builder-dashboard-builder.model.ts"],"names":[],"mappings":"","file":"report-builder-dashboard-builder.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\nimport { ReportBuilderReportType } from './report-builder-report.model';\n\nexport interface ReportBuilderDashboardBuilder extends CollectionDocument {\n\tname: string;\n\tdate_created: Date;\n\tuser_created: string;\n\tnum_rows: number;\n\tnum_columns: number;\n\treports: ReportBuilderDashboardBuilderReportModel[];\n}\n\nexport interface ReportBuilderDashboardBuilderReportModel {\n\tid_report: string;\n\treport_name: string;\n\treport_type: ReportBuilderReportType;\n\tdisplay_type: ReportBuilderDashboardBuilderReportDisplayType;\n}\n\nexport type ReportBuilderDashboardBuilderReportDisplayType = 'Data' | 'Bar' | 'Line' | 'Pie';"]}
|