mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: show connetion count on /info
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"ip": "IP <strong>%1</strong>",
|
"ip": "IP <strong>%1</strong>",
|
||||||
"nodes-responded": "%1 nodes responded within %2ms!",
|
"nodes-responded": "%1 nodes responded within %2ms!",
|
||||||
"host": "host",
|
"host": "host",
|
||||||
"primary": "primary / run jobs",
|
"primary": "primary / jobs",
|
||||||
"pid": "pid",
|
"pid": "pid",
|
||||||
"nodejs": "nodejs",
|
"nodejs": "nodejs",
|
||||||
"online": "online",
|
"online": "online",
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
"registered": "Registered",
|
"registered": "Registered",
|
||||||
"sockets": "Sockets",
|
"sockets": "Sockets",
|
||||||
|
"connection-count": "Connection Count",
|
||||||
"guests": "Guests",
|
"guests": "Guests",
|
||||||
|
|
||||||
"info": "Info"
|
"info": "Info"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
const topics = require('../../topics');
|
const topics = require('../../topics');
|
||||||
const io = require('..');
|
const io = require('..');
|
||||||
|
const webserver = require('../../webserver');
|
||||||
|
|
||||||
const totals = {};
|
const totals = {};
|
||||||
|
|
||||||
@@ -94,6 +95,7 @@ SocketRooms.getLocalStats = function () {
|
|||||||
onlineGuestCount: 0,
|
onlineGuestCount: 0,
|
||||||
onlineRegisteredCount: 0,
|
onlineRegisteredCount: 0,
|
||||||
socketCount: 0,
|
socketCount: 0,
|
||||||
|
connectionCount: webserver.getConnectionCount(),
|
||||||
users: {
|
users: {
|
||||||
categories: 0,
|
categories: 0,
|
||||||
recent: 0,
|
recent: 0,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<td class="fw-bold">[[admin/development/info:process-memory]]</td>
|
<td class="fw-bold">[[admin/development/info:process-memory]]</td>
|
||||||
<td class="fw-bold">[[admin/development/info:system-memory]]</td>
|
<td class="fw-bold">[[admin/development/info:system-memory]]</td>
|
||||||
<td class="fw-bold">[[admin/development/info:load]]</td>
|
<td class="fw-bold">[[admin/development/info:load]]</td>
|
||||||
<td class="fw-bold">[[admin/development/info:uptime]]</td>
|
<td class="fw-bold text-end">[[admin/development/info:uptime]]</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="text-xs">
|
<tbody class="text-xs">
|
||||||
@@ -34,7 +34,8 @@
|
|||||||
<td>
|
<td>
|
||||||
<span title="[[admin/development/info:registered]]">{info.stats.onlineRegisteredCount}</span> /
|
<span title="[[admin/development/info:registered]]">{info.stats.onlineRegisteredCount}</span> /
|
||||||
<span title="[[admin/development/info:guests]]">{info.stats.onlineGuestCount}</span> /
|
<span title="[[admin/development/info:guests]]">{info.stats.onlineGuestCount}</span> /
|
||||||
<span title="[[admin/development/info:sockets]]">{info.stats.socketCount}</span>
|
<span title="[[admin/development/info:sockets]]">{info.stats.socketCount}</span> /
|
||||||
|
<span title="[[admin/development/info:connection-count]]">{info.stats.connectionCount}</span>
|
||||||
</td>
|
</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.git.branch}@<a href="https://github.com/NodeBB/NodeBB/commit/{info.git.hash}" target="_blank">{info.git.hashShort}</a></td>
|
||||||
<td>{info.process.cpuUsage}%</td>
|
<td>{info.process.cpuUsage}%</td>
|
||||||
@@ -46,7 +47,7 @@
|
|||||||
<span title="[[admin/development/info:total-memory-os]]">{info.os.totalmem} gb</span>
|
<span title="[[admin/development/info:total-memory-os]]">{info.os.totalmem} gb</span>
|
||||||
</td>
|
</td>
|
||||||
<td>{info.os.load}</td>
|
<td>{info.os.load}</td>
|
||||||
<td>{info.process.uptimeHumanReadable}</td>
|
<td class="text-end">{info.process.uptimeHumanReadable}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{{ end }}}
|
{{{ end }}}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -76,6 +76,10 @@ exports.destroy = function (callback) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.getConnectionCount = function () {
|
||||||
|
return Object.keys(connections).length;
|
||||||
|
};
|
||||||
|
|
||||||
exports.listen = async function () {
|
exports.listen = async function () {
|
||||||
emailer.registerApp(app);
|
emailer.registerApp(app);
|
||||||
setupExpressApp(app);
|
setupExpressApp(app);
|
||||||
|
|||||||
Reference in New Issue
Block a user