pms_md 1.0.4 → 1.0.6
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/.gitignore +158 -0
- package/README.md +69 -1
- package/node-monitor/DESIGN_IMPROVEMENTS.md +286 -0
- package/node-monitor/FILTER_BUTTONS_FIX.md +303 -0
- package/node-monitor/PUBLISHING_GUIDE.md +331 -0
- package/node-monitor/READY_TO_PUBLISH.md +272 -0
- package/node-monitor/examples/views/layout.ejs +1 -1
- package/node-monitor/examples/views/partials/footer.ejs +1 -1
- package/node-monitor/examples/views/status.ejs +1 -1
- package/node-monitor/package-lock.json +4307 -4300
- package/node-monitor/package.json +79 -79
- package/node-monitor/src/index.js +322 -300
- package/node-monitor/src/ui/uiRouter.js +261 -0
- package/node-monitor/src/views/dashboard.html +1 -1
- package/package.json +131 -123
- package/BUILD_SUMMARY.md +0 -257
- package/CHANGELOG.md +0 -190
- package/DATABASE_SUPPORT.md +0 -582
- package/FINAL_CHECKLIST.md +0 -210
- package/PACKAGE_READY.txt +0 -169
- package/PEER_DEPENDENCY_FIX.txt +0 -57
- package/QUICK_DATABASE_REFERENCE.md +0 -247
- package/RELEASE_v1.0.3.md +0 -237
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI Router - Serves monitoring UI from package
|
|
3
|
+
* Provides automatic UI setup for monitoring dashboards
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
|
|
9
|
+
class UIRouter {
|
|
10
|
+
constructor(monitor, options = {}) {
|
|
11
|
+
this.monitor = monitor;
|
|
12
|
+
this.options = {
|
|
13
|
+
basePath: options.basePath || '',
|
|
14
|
+
enableErrorLogs: options.enableErrorLogs !== false,
|
|
15
|
+
appName: options.appName || monitor.config.get('app.name') || 'Node Monitor',
|
|
16
|
+
...options
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// Resolve package paths
|
|
20
|
+
this.packageRoot = path.resolve(__dirname, '../../');
|
|
21
|
+
this.viewsPath = path.join(this.packageRoot, 'examples/views');
|
|
22
|
+
this.publicPath = path.join(this.packageRoot, 'examples/public');
|
|
23
|
+
|
|
24
|
+
// Verify paths exist
|
|
25
|
+
this.verifyPaths();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
verifyPaths() {
|
|
29
|
+
if (!fs.existsSync(this.viewsPath)) {
|
|
30
|
+
throw new Error(`Views directory not found at: ${this.viewsPath}`);
|
|
31
|
+
}
|
|
32
|
+
if (!fs.existsSync(this.publicPath)) {
|
|
33
|
+
throw new Error(`Public directory not found at: ${this.publicPath}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Setup UI routes on Express app
|
|
39
|
+
*/
|
|
40
|
+
setup(app) {
|
|
41
|
+
// Configure EJS view engine
|
|
42
|
+
app.set('view engine', 'ejs');
|
|
43
|
+
app.set('views', this.viewsPath);
|
|
44
|
+
|
|
45
|
+
// Serve static files (CSS, JS, images)
|
|
46
|
+
const express = require('express');
|
|
47
|
+
app.use(express.static(this.publicPath));
|
|
48
|
+
|
|
49
|
+
// Register all UI routes
|
|
50
|
+
this.registerRoutes(app);
|
|
51
|
+
|
|
52
|
+
console.log(`✅ Node Monitor UI enabled at http://localhost:${app.get('port') || 3000}/`);
|
|
53
|
+
console.log(` 📊 Dashboard: /monitor/dashboard`);
|
|
54
|
+
console.log(` 💚 Health: /health`);
|
|
55
|
+
console.log(` 📈 Metrics: /monitor/metrics`);
|
|
56
|
+
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Register all UI routes
|
|
62
|
+
*/
|
|
63
|
+
registerRoutes(app) {
|
|
64
|
+
const basePath = this.options.basePath;
|
|
65
|
+
|
|
66
|
+
// Home route
|
|
67
|
+
app.get(`${basePath}/`, this.homeRoute.bind(this));
|
|
68
|
+
|
|
69
|
+
// Health check route
|
|
70
|
+
app.get(`${basePath}/health`, this.healthRoute.bind(this));
|
|
71
|
+
|
|
72
|
+
// Dashboard route
|
|
73
|
+
app.get(`${basePath}/monitor/dashboard`, this.dashboardRoute.bind(this));
|
|
74
|
+
|
|
75
|
+
// Status route
|
|
76
|
+
app.get(`${basePath}/monitor/status`, this.statusRoute.bind(this));
|
|
77
|
+
|
|
78
|
+
// Metrics route
|
|
79
|
+
app.get(`${basePath}/monitor/metrics`, this.metricsRoute.bind(this));
|
|
80
|
+
|
|
81
|
+
// System info route (JSON only)
|
|
82
|
+
app.get(`${basePath}/monitor/system`, this.systemRoute.bind(this));
|
|
83
|
+
|
|
84
|
+
// Health info route (JSON only)
|
|
85
|
+
app.get(`${basePath}/health/info`, this.healthInfoRoute.bind(this));
|
|
86
|
+
|
|
87
|
+
// Error logs route (if enabled)
|
|
88
|
+
if (this.options.enableErrorLogs) {
|
|
89
|
+
app.get(`${basePath}/monitor/error-logs`, this.errorLogsRoute.bind(this));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Check if request wants JSON
|
|
95
|
+
*/
|
|
96
|
+
wantsJson(req) {
|
|
97
|
+
const acceptsJson = req.headers.accept && req.headers.accept.includes('application/json');
|
|
98
|
+
const formatJson = req.query.format === 'json';
|
|
99
|
+
return formatJson || acceptsJson;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Home route handler
|
|
104
|
+
*/
|
|
105
|
+
homeRoute(req, res) {
|
|
106
|
+
if (this.wantsJson(req)) {
|
|
107
|
+
return res.json({
|
|
108
|
+
message: `Welcome to ${this.options.appName} Monitoring`,
|
|
109
|
+
endpoints: {
|
|
110
|
+
home: '/',
|
|
111
|
+
health: '/health',
|
|
112
|
+
healthInfo: '/health/info',
|
|
113
|
+
dashboard: '/monitor/dashboard',
|
|
114
|
+
status: '/monitor/status',
|
|
115
|
+
system: '/monitor/system',
|
|
116
|
+
metrics: '/monitor/metrics',
|
|
117
|
+
errorLogs: this.options.enableErrorLogs ? '/monitor/error-logs' : null
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
res.render('home', {
|
|
123
|
+
title: 'Home',
|
|
124
|
+
headerIcon: '🏠',
|
|
125
|
+
headerTitle: this.options.appName,
|
|
126
|
+
subtitle: null,
|
|
127
|
+
currentPage: 'home',
|
|
128
|
+
includeCharts: false,
|
|
129
|
+
pageScript: null
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Health check route handler
|
|
135
|
+
*/
|
|
136
|
+
healthRoute(req, res) {
|
|
137
|
+
if (this.wantsJson(req)) {
|
|
138
|
+
return this.monitor.healthCheckEndpoint()(req, res);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
res.render('health', {
|
|
142
|
+
title: 'Health Check',
|
|
143
|
+
headerIcon: '💚',
|
|
144
|
+
headerTitle: 'Health Check',
|
|
145
|
+
subtitle: 'System health status and monitoring',
|
|
146
|
+
currentPage: 'health',
|
|
147
|
+
includeCharts: false,
|
|
148
|
+
pageScript: 'health.js'
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Dashboard route handler
|
|
154
|
+
*/
|
|
155
|
+
dashboardRoute(req, res) {
|
|
156
|
+
if (this.wantsJson(req)) {
|
|
157
|
+
return this.monitor.dashboardEndpoint()(req, res);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
res.render('dashboard', {
|
|
161
|
+
title: 'Dashboard',
|
|
162
|
+
headerIcon: '📊',
|
|
163
|
+
headerTitle: 'Monitoring Dashboard',
|
|
164
|
+
subtitle: 'Real-time application monitoring and analytics',
|
|
165
|
+
currentPage: 'dashboard',
|
|
166
|
+
includeCharts: false,
|
|
167
|
+
pageScript: 'dashboard.js'
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Status route handler
|
|
173
|
+
*/
|
|
174
|
+
statusRoute(req, res) {
|
|
175
|
+
if (this.wantsJson(req)) {
|
|
176
|
+
return res.json(this.monitor.getStatus());
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
res.render('status', {
|
|
180
|
+
title: 'API Status',
|
|
181
|
+
headerIcon: '📋',
|
|
182
|
+
headerTitle: 'API Status',
|
|
183
|
+
subtitle: 'Real-time application status and metrics',
|
|
184
|
+
currentPage: 'status',
|
|
185
|
+
includeCharts: false,
|
|
186
|
+
pageScript: null
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Metrics route handler
|
|
192
|
+
*/
|
|
193
|
+
metricsRoute(req, res) {
|
|
194
|
+
if (this.wantsJson(req)) {
|
|
195
|
+
return res.json({
|
|
196
|
+
timestamp: new Date().toISOString(),
|
|
197
|
+
history: this.monitor.getMetricsHistory()
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
res.render('metrics', {
|
|
202
|
+
title: 'Metrics',
|
|
203
|
+
headerIcon: '📈',
|
|
204
|
+
headerTitle: 'System Metrics',
|
|
205
|
+
subtitle: 'Performance monitoring and analytics',
|
|
206
|
+
currentPage: 'metrics',
|
|
207
|
+
includeCharts: true,
|
|
208
|
+
pageScript: 'metrics.js'
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* System info route handler (JSON only)
|
|
214
|
+
*/
|
|
215
|
+
systemRoute(req, res) {
|
|
216
|
+
res.json(this.monitor.getSystemInfo());
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Health info route handler (JSON only)
|
|
221
|
+
*/
|
|
222
|
+
healthInfoRoute(req, res) {
|
|
223
|
+
this.monitor.healthInfoEndpoint()(req, res);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Error logs route handler
|
|
228
|
+
*/
|
|
229
|
+
errorLogsRoute(req, res) {
|
|
230
|
+
if (this.wantsJson(req)) {
|
|
231
|
+
return res.json({
|
|
232
|
+
message: 'Error logs endpoint',
|
|
233
|
+
logs: []
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
res.render('error-logs', {
|
|
238
|
+
title: 'Error Logs',
|
|
239
|
+
headerIcon: '🚨',
|
|
240
|
+
headerTitle: 'Error Logs',
|
|
241
|
+
subtitle: 'Application error tracking',
|
|
242
|
+
currentPage: 'error-logs',
|
|
243
|
+
includeCharts: false,
|
|
244
|
+
pageScript: 'error-logs.js'
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Factory function to setup UI
|
|
251
|
+
*/
|
|
252
|
+
function setup(app, monitor, options = {}) {
|
|
253
|
+
const router = new UIRouter(monitor, options);
|
|
254
|
+
return router.setup(app);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
module.exports = {
|
|
258
|
+
UIRouter,
|
|
259
|
+
setup
|
|
260
|
+
};
|
|
261
|
+
|
package/package.json
CHANGED
|
@@ -1,123 +1,131 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pms_md",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Comprehensive monitoring solution for Node.js applications with error tracking, health checks, multi-database support (MongoDB, PostgreSQL, MySQL, MSSQL, SQLite, Redis, Cassandra, Elasticsearch, DynamoDB, Neo4j, CouchDB), and multi-channel notifications",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"cassandra-driver": "^4.0.0",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"
|
|
122
|
-
|
|
123
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "pms_md",
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"description": "Comprehensive monitoring solution for Node.js applications with error tracking, health checks, multi-database support (MongoDB, PostgreSQL, MySQL, MSSQL, SQLite, Redis, Cassandra, Elasticsearch, DynamoDB, Neo4j, CouchDB), and multi-channel notifications",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"index.js",
|
|
8
|
+
"node-monitor/",
|
|
9
|
+
"README.md",
|
|
10
|
+
".gitignore"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "jest",
|
|
14
|
+
"start": "node node-monitor/examples/express-app.js"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://gitlab.com/manish-proses/pms_md.git"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"proses",
|
|
22
|
+
"monitoring",
|
|
23
|
+
"health-check",
|
|
24
|
+
"error-tracking",
|
|
25
|
+
"notifications",
|
|
26
|
+
"alerts",
|
|
27
|
+
"nodejs",
|
|
28
|
+
"express",
|
|
29
|
+
"logging",
|
|
30
|
+
"winston",
|
|
31
|
+
"error-handler",
|
|
32
|
+
"health-monitoring",
|
|
33
|
+
"system-monitoring",
|
|
34
|
+
"email-notifications",
|
|
35
|
+
"slack-notifications"
|
|
36
|
+
],
|
|
37
|
+
"author": "Manish Desai",
|
|
38
|
+
"license": "ISC",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://gitlab.com/manish-proses/pms_md/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://gitlab.com/manish-proses/pms_md#readme",
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@slack/webhook": "^7.0.2",
|
|
45
|
+
"axios": "^1.6.2",
|
|
46
|
+
"dotenv": "^17.2.3",
|
|
47
|
+
"ejs": "^3.1.10",
|
|
48
|
+
"node-cron": "^3.0.3",
|
|
49
|
+
"nodemailer": "^6.9.7",
|
|
50
|
+
"winston": "^3.11.0",
|
|
51
|
+
"winston-daily-rotate-file": "^4.7.1"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@aws-sdk/client-dynamodb": "^3.0.0",
|
|
55
|
+
"@elastic/elasticsearch": "^8.0.0",
|
|
56
|
+
"aws-sdk": "^2.0.0",
|
|
57
|
+
"better-sqlite3": "^8.0.0 || ^9.0.0",
|
|
58
|
+
"cassandra-driver": "^4.0.0",
|
|
59
|
+
"express": "^4.18.0 || ^5.0.0",
|
|
60
|
+
"ioredis": "^5.0.0",
|
|
61
|
+
"mariadb": "^3.0.0",
|
|
62
|
+
"mongoose": "^7.0.0 || ^8.0.0",
|
|
63
|
+
"mssql": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
64
|
+
"mysql2": "^2.0.0 || ^3.0.0",
|
|
65
|
+
"nano": "^10.0.0",
|
|
66
|
+
"neo4j-driver": "^5.0.0",
|
|
67
|
+
"pg": "^8.0.0",
|
|
68
|
+
"sequelize": "^6.0.0",
|
|
69
|
+
"sqlite3": "^5.0.0",
|
|
70
|
+
"tedious": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
71
|
+
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"express": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"mongoose": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"pg": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"mysql2": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"mariadb": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"mssql": {
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
91
|
+
"tedious": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"sqlite3": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"better-sqlite3": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"sequelize": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"ioredis": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"nano": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"cassandra-driver": {
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
"@elastic/elasticsearch": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"@aws-sdk/client-dynamodb": {
|
|
116
|
+
"optional": true
|
|
117
|
+
},
|
|
118
|
+
"aws-sdk": {
|
|
119
|
+
"optional": true
|
|
120
|
+
},
|
|
121
|
+
"neo4j-driver": {
|
|
122
|
+
"optional": true
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"devDependencies": {
|
|
126
|
+
"jest": "^29.7.0"
|
|
127
|
+
},
|
|
128
|
+
"engines": {
|
|
129
|
+
"node": ">=14.0.0"
|
|
130
|
+
}
|
|
131
|
+
}
|