From 969234da4b82c05df2b5dc5d109f60e06b43049a Mon Sep 17 00:00:00 2001 From: Arturs Sosins Date: Fri, 22 Feb 2019 11:33:02 +0200 Subject: [PATCH] [system-utility] ignore boot disks and buffer cache --- plugins/system-utility/api/system.utility.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/system-utility/api/system.utility.js b/plugins/system-utility/api/system.utility.js index db331f3b725..54bd3e8a05f 100644 --- a/plugins/system-utility/api/system.utility.js +++ b/plugins/system-utility/api/system.utility.js @@ -134,18 +134,21 @@ function memoryUsage() { lines.pop(); - var details = lines - .map(line => line.replace(/[\s\n\r]+/g, ' ').replace(":", '').split(' ')) - .map(line => { - return { + var details = []; + for (var i = 0; i < lines.length; i++) { + var line = lines[i]; + line = line.replace(/[\s\n\r]+/g, ' ').replace(":", '').split(' '); + if (line[0].toLowerCase() !== "-/+") { + details.push({ id: line[0].toLowerCase(), usage: ((100 * line[2]) / line[1]) || 0, total: line[1], used: line[2], free: line[1] - line[2], units: "Byte" - }; - }); + }); + } + } var response = { overall: { @@ -206,7 +209,7 @@ function disksUsage() { for (var i = 0; i < lines.length; i++) { var str_disk_info = lines[i].replace(/[\s\n\r]+/g, ' '); var disk_info = str_disk_info.split(' '); - if (disk_info[0] && !(disk_info[0] + "").startsWith("/dev/loop")) { + if (disk_info[0] && !(disk_info[0] + "").startsWith("/dev/loop") && !(disk_info[5] + "").startsWith("/boot")) { result = {}; result.fileSystem = disk_info[0]; result.usage = (disk_info[2] / disk_info[1]) * 100;