mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 14:16:01 +00:00
SYNC: health status
This commit is contained in:
committed by
Diflow
parent
d5f8e01dd8
commit
3bb4652a49
25
packages/api/src/utility/healthStatus.js
Normal file
25
packages/api/src/utility/healthStatus.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const os = require('os');
|
||||
|
||||
const databaseConnections = require('../controllers/databaseConnections');
|
||||
const serverConnections = require('../controllers/serverConnections');
|
||||
const sessions = require('../controllers/sessions');
|
||||
const runners = require('../controllers/runners');
|
||||
|
||||
async function getHealthStatus() {
|
||||
const memory = process.memoryUsage();
|
||||
|
||||
return {
|
||||
status: 'ok',
|
||||
databaseConnectionCount: databaseConnections.opened.length,
|
||||
serverConnectionCount: serverConnections.opened.length,
|
||||
sessionCount: sessions.opened.length,
|
||||
memory,
|
||||
systemMemory: {
|
||||
total: os.totalmem(),
|
||||
free: os.freemem(),
|
||||
},
|
||||
runProcessCount: runners.opened.length,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = getHealthStatus;
|
||||
Reference in New Issue
Block a user