added mongodb memory usage

v1.18.x
Barış Soner Uşaklı 10 years ago
parent fd87bedc90
commit 235a981dd1

@ -177,16 +177,25 @@
};
module.info = function(db, callback) {
db.stats({scale:1024}, function(err, stats) {
if(err) {
async.parallel({
serverStats: function(next) {
db.command({'serverStatus': 1}, next);
},
stats: function(next) {
db.stats({scale:1024}, next);
}
}, function(err, results) {
if (err) {
return callback(err);
}
var stats = results.stats;
stats.avgObjSize = (stats.avgObjSize / 1024).toFixed(2);
stats.dataSize = (stats.dataSize / 1024).toFixed(2);
stats.storageSize = (stats.storageSize / 1024).toFixed(2);
stats.fileSize = (stats.fileSize / 1024).toFixed(2);
stats.indexSize = (stats.indexSize / 1024).toFixed(2);
stats.mem = results.serverStats.mem;
stats.raw = JSON.stringify(stats, null, 4);
stats.mongo = true;

@ -13,6 +13,10 @@
<span>Storage Size</span> <span class="text-right">{mongo.storageSize} mb</span><br/>
<span>Index Size</span> <span class="text-right">{mongo.indexSize} mb</span><br/>
<span>File Size</span> <span class="text-right">{mongo.fileSize} mb</span><br/>
<hr/>
<span>Resident Memory</span> <span class="text-right">{mongo.mem.resident} mb</span><br/>
<span>Virtual Memory</span> <span class="text-right">{mongo.mem.virtual} mb</span><br/>
<span>Mapped Memory</span> <span class="text-right">{mongo.mem.mapped} mb</span><br/>
</div>
</div>
</div>

Loading…
Cancel
Save