Mongo serverStatus
Node.js library to get MongoDB serverStatus informations.
Usage exemple
Install with npm install mongodb-serverstatus
and you're ready to go!
const serverStatus = require('mongodb-serverstatus');
var config = {
dbPath: 'mongodb://localhost/mydatabase',
dbOptions: {
user: '',
pass: '',
server: {
ssl: false,
sslValidate: false
},
}
};
serverStatus.init(config);
serverStatus.memory((data) => {
console.log(data);
});
Functions
-
usedConnections – {number}
: percentage of open connections -
memory – {object}
: RAM and virtual memory used in MB -
flushAvgTime – {number}
: the average time in milliseconds for each flush to disk -
lastFlushTime – {number}
: time in milliseconds for the last flush -
rawData – {object}
: all mongo serverStatus infos -
status – {bool}
: request status -
storageEngine – {string}
: storage engine used -
uptime – {int}
: the number of seconds that the current MongoDB process has been active