Skip to content

Commit

Permalink
feat: add free and total mem usage to info
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Oct 22, 2020
1 parent 63e07c9 commit a7b6d0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/controllers/admin/info.js
Expand Up @@ -78,6 +78,8 @@ async function getNodeInfo() {
arch: os.arch(),
release: os.release(),
load: os.loadavg().map(function (load) { return load.toFixed(2); }).join(', '),
freemem: os.freemem(),
totalmem: os.totalmem(),
},
nodebb: {
isCluster: nconf.get('isCluster'),
Expand All @@ -91,7 +93,8 @@ async function getNodeInfo() {
data.process.cpuUsage.system /= 1000000;
data.process.cpuUsage.system = data.process.cpuUsage.system.toFixed(2);
data.process.memoryUsage.humanReadable = (data.process.memoryUsage.rss / (1024 * 1024)).toFixed(2);

data.os.freemem = (data.os.freemem / 1000000).toFixed(2);
data.os.totalmem = (data.os.totalmem / 1000000).toFixed(2);
const [stats, gitInfo] = await Promise.all([
rooms.getLocalStats(),
getGitInfo(),
Expand Down
2 changes: 1 addition & 1 deletion src/views/admin/development/info.tpl
Expand Up @@ -39,7 +39,7 @@
</td>
<td>{info.git.branch}@<a href="https://github.com/NodeBB/NodeBB/commit/{info.git.hash}" target="_blank">{info.git.hashShort}</a></td>
<td>{info.process.cpuUsage.user} / {info.process.cpuUsage.system}</td>
<td>{info.process.memoryUsage.humanReadable} mb</td>
<td>{info.process.memoryUsage.humanReadable} mb / {info.os.freemem} mb</td>
<td>{info.os.load}</td>
<td>{info.process.uptime}</td>
</tr>
Expand Down

0 comments on commit a7b6d0d

Please sign in to comment.