1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Showing available memory on Linux when available.

This commit is contained in:
Ylian Saint-Hilaire 2020-08-16 12:18:47 -07:00
parent 3a016138ad
commit ec465de878
4 changed files with 493 additions and 464 deletions

View file

@ -346,7 +346,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
// Take a look at server stats
var os = require('os');
var stats = { action: 'serverstats', totalmem: os.totalmem(), freemem: os.freemem() };
if (parent.parent.platform != 'win32') { stats.cpuavg = os.loadavg(); }
if (parent.parent.platform != 'win32') {
stats.cpuavg = os.loadavg();
try { stats.availablemem = 1024 * Number(/MemAvailable:[ ]+(\d+)/.exec(fs.readFileSync('/proc/meminfo', 'utf8'))[1]); } catch (ex) { }
}
// Count the number of device groups that are not deleted
var activeDeviceGroups = 0;