mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-26 08:31:22 +01:00
add memory usage to info page
This commit is contained in:
@@ -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,21 +76,25 @@ function getNodeInfo(callback) {
|
||||
},
|
||||
};
|
||||
|
||||
async.parallel({
|
||||
stats: function (next) {
|
||||
rooms.getLocalStats(next);
|
||||
data.process.memoryUsage.humanReadable = (data.process.memoryUsage.rss / (1024 * 1024)).toFixed(2);
|
||||
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
async.parallel({
|
||||
stats: function (next) {
|
||||
rooms.getLocalStats(next);
|
||||
},
|
||||
gitInfo: function (next) {
|
||||
getGitInfo(next);
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
gitInfo: function (next) {
|
||||
getGitInfo(next);
|
||||
function (results, next) {
|
||||
data.git = results.gitInfo;
|
||||
data.stats = results.stats;
|
||||
next(null, data);
|
||||
},
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
data.git = results.gitInfo;
|
||||
data.stats = results.stats;
|
||||
callback(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>
|
||||
|
||||
Reference in New Issue
Block a user