mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
added mongodb memory usage
This commit is contained in:
@@ -177,16 +177,25 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.info = function(db, callback) {
|
module.info = function(db, callback) {
|
||||||
db.stats({scale:1024}, function(err, stats) {
|
async.parallel({
|
||||||
if(err) {
|
serverStats: function(next) {
|
||||||
|
db.command({'serverStatus': 1}, next);
|
||||||
|
},
|
||||||
|
stats: function(next) {
|
||||||
|
db.stats({scale:1024}, next);
|
||||||
|
}
|
||||||
|
}, function(err, results) {
|
||||||
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
var stats = results.stats;
|
||||||
|
|
||||||
stats.avgObjSize = (stats.avgObjSize / 1024).toFixed(2);
|
stats.avgObjSize = (stats.avgObjSize / 1024).toFixed(2);
|
||||||
stats.dataSize = (stats.dataSize / 1024).toFixed(2);
|
stats.dataSize = (stats.dataSize / 1024).toFixed(2);
|
||||||
stats.storageSize = (stats.storageSize / 1024).toFixed(2);
|
stats.storageSize = (stats.storageSize / 1024).toFixed(2);
|
||||||
stats.fileSize = (stats.fileSize / 1024).toFixed(2);
|
stats.fileSize = (stats.fileSize / 1024).toFixed(2);
|
||||||
stats.indexSize = (stats.indexSize / 1024).toFixed(2);
|
stats.indexSize = (stats.indexSize / 1024).toFixed(2);
|
||||||
|
stats.mem = results.serverStats.mem;
|
||||||
stats.raw = JSON.stringify(stats, null, 4);
|
stats.raw = JSON.stringify(stats, null, 4);
|
||||||
stats.mongo = true;
|
stats.mongo = true;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,10 @@
|
|||||||
<span>Storage Size</span> <span class="text-right">{mongo.storageSize} mb</span><br/>
|
<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>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/>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user