add memory usage to info page

v1.18.x
Barış Soner Uşaklı 8 years ago
parent 932247f440
commit 9664033b73

@ -6,6 +6,7 @@
"nodejs": "nodejs",
"online": "online",
"git": "git",
"memory": "memory",
"load": "load",
"uptime": "uptime",

@ -9,7 +9,7 @@ var exec = require('child_process').exec;
var pubsub = require('../../pubsub');
var rooms = require('../../socket.io/admin/rooms');
var infoController = {};
var infoController = module.exports;
var info = {};
@ -76,6 +76,10 @@ function getNodeInfo(callback) {
},
};
data.process.memoryUsage.humanReadable = (data.process.memoryUsage.rss / (1024 * 1024)).toFixed(2);
async.waterfall([
function (next) {
async.parallel({
stats: function (next) {
rooms.getLocalStats(next);
@ -83,14 +87,14 @@ function getNodeInfo(callback) {
gitInfo: function (next) {
getGitInfo(next);
},
}, function (err, results) {
if (err) {
return callback(err);
}
}, next);
},
function (results, next) {
data.git = results.gitInfo;
data.stats = results.stats;
callback(null, data);
});
next(null, data);
},
], callback);
}
function getGitInfo(callback) {
@ -111,5 +115,3 @@ function getGitInfo(callback) {
},
}, callback);
}
module.exports = infoController;

@ -15,6 +15,7 @@
<td>[[admin/development/info:nodejs]]</td>
<td>[[admin/development/info:online]]</td>
<td>[[admin/development/info:git]]</td>
<td>[[admin/development/info:memory]]</td>
<td>[[admin/development/info:load]]</td>
<td>[[admin/development/info:uptime]]</td>
</tr>
@ -31,6 +32,7 @@
<span title="[[admin/development/info:sockets]]">{info.stats.socketCount}</span>
</td>
<td>{info.git.branch}@<a href="https://github.com/NodeBB/NodeBB/commit/{info.git.hash}" target="_blank">{info.git.hash}</a></td>
<td>{info.process.memoryUsage.humanReadable} mb</td>
<td>{info.os.load}</td>
<td>{info.process.uptime}</td>
</tr>

Loading…
Cancel
Save