From 235a981dd10ba443776e088ee5de457eb35b829e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 12 Aug 2015 16:14:48 -0400 Subject: [PATCH] added mongodb memory usage --- src/database/mongo.js | 13 +++++++++++-- src/views/admin/advanced/database.tpl | 4 ++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/database/mongo.js b/src/database/mongo.js index 389a85bf7d..49f2da5edd 100644 --- a/src/database/mongo.js +++ b/src/database/mongo.js @@ -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; diff --git a/src/views/admin/advanced/database.tpl b/src/views/admin/advanced/database.tpl index 0390e7a681..b868b322a9 100644 --- a/src/views/admin/advanced/database.tpl +++ b/src/views/admin/advanced/database.tpl @@ -13,6 +13,10 @@ Storage Size {mongo.storageSize} mb
Index Size {mongo.indexSize} mb
File Size {mongo.fileSize} mb
+
+ Resident Memory {mongo.mem.resident} mb
+ Virtual Memory {mongo.mem.virtual} mb
+ Mapped Memory {mongo.mem.mapped} mb