Added total memory to device CSV export, #3616
This commit is contained in:
parent
f7b2406e8d
commit
6f3a0e67dd
17
meshuser.js
17
meshuser.js
|
@ -4583,7 +4583,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
if (type == 'csv') {
|
||||
try {
|
||||
// Create the CSV file
|
||||
output = 'id,name,rname,host,icon,ip,osdesc,groupname,av,update,firewall,avdetails,cpu,osbuild,biosDate,biosVendor,biosVersion,boardName,boardVendor,boardVersion,productUuid,agentOpenSSL,agentCommitDate,agentCommitHash,agentCompileTime,netIfCount,macs,addresses,lastConnectTime,lastConnectAddr\r\n';
|
||||
output = 'id,name,rname,host,icon,ip,osdesc,groupname,av,update,firewall,avdetails,cpu,osbuild,biosDate,biosVendor,biosVersion,boardName,boardVendor,boardVersion,productUuid,totalMemory,agentOpenSSL,agentCommitDate,agentCommitHash,agentCompileTime,netIfCount,macs,addresses,lastConnectTime,lastConnectAddr\r\n';
|
||||
for (var i = 0; i < results.length; i++) {
|
||||
const nodeinfo = results[i];
|
||||
|
||||
|
@ -4625,6 +4625,17 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.board_version)) { output += csvClean(nodeinfo.sys.hardware.identifiers.board_version); }
|
||||
output += ',';
|
||||
if (nodeinfo.sys.hardware.identifiers && (nodeinfo.sys.hardware.identifiers.product_uuid)) { output += csvClean(nodeinfo.sys.hardware.identifiers.product_uuid); }
|
||||
output += ',';
|
||||
if (nodeinfo.sys.hardware.windows.memory) {
|
||||
var totalMemory = 0;
|
||||
for (var j in nodeinfo.sys.hardware.windows.memory) {
|
||||
if (nodeinfo.sys.hardware.windows.memory[j].Capacity) {
|
||||
if (typeof nodeinfo.sys.hardware.windows.memory[j].Capacity == 'number') { totalMemory += nodeinfo.sys.hardware.windows.memory[j].Capacity; }
|
||||
if (typeof nodeinfo.sys.hardware.windows.memory[j].Capacity == 'string') { totalMemory += parseInt(nodeinfo.sys.hardware.windows.memory[j].Capacity); }
|
||||
}
|
||||
}
|
||||
output += csvClean('' + totalMemory);
|
||||
}
|
||||
} else if ((nodeinfo.sys) && (nodeinfo.sys.hardware) && (nodeinfo.sys.hardware.mobile)) {
|
||||
// Mobile
|
||||
output += ',';
|
||||
|
@ -4640,6 +4651,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
output += ',';
|
||||
output += ',';
|
||||
if (nodeinfo.sys.hardware.mobile && (nodeinfo.sys.hardware.mobile.id)) { output += csvClean(nodeinfo.sys.hardware.mobile.id); }
|
||||
output += ',';
|
||||
} else if ((nodeinfo.sys) && (nodeinfo.sys.hardware) && (nodeinfo.sys.hardware.windows) && (nodeinfo.sys.hardware.linux)) {
|
||||
// Linux
|
||||
output += ',';
|
||||
|
@ -4658,8 +4670,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.board_version)) { output += csvClean(nodeinfo.sys.hardware.linux.board_version); }
|
||||
output += ',';
|
||||
if (nodeinfo.sys.hardware.linux && (nodeinfo.sys.hardware.linux.product_uuid)) { output += csvClean(nodeinfo.sys.hardware.linux.product_uuid); }
|
||||
output += ',';
|
||||
} else {
|
||||
output += ',,,,,,,,,';
|
||||
output += ',,,,,,,,,,';
|
||||
}
|
||||
|
||||
// Agent information
|
||||
|
|
Loading…
Reference in New Issue