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

add linux storage volumes using df

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2024-05-13 23:44:47 +01:00
parent b71b4d04e6
commit e3f68226d2
4 changed files with 3566 additions and 3472 deletions

View file

@ -6456,6 +6456,35 @@
if (x != '') { sections.push({ name: "Storage Volumes", html: '<table style=width:100%>' + x + '</table>', img: 'storage'}); }
}
// Linux Volumes
if (hardware.linux && hardware.linux.volumes) {
var x = '';
for (var i in hardware.linux.volumes) {
var m = hardware.linux.volumes[i];
if(m.mount_point.startsWith('/var/lib/docker/overlay2')) continue;
x += '<tr><td><div class=style10 style=border-radius:5px;padding:8px>';
x += '<div style=margin-bottom:3px><b>' + m.mount_point + '</b></div>';
if (m.size) {
var sizes = ['KB', 'MB', 'GB', 'TB'];
var j = parseInt(Math.floor(Math.log(Math.abs(m.size)) / Math.log(1024)), 10);
var fsize = (j === 0 ? `${m.size} ${sizes[j]}` : `${(m.size / (1024 ** j)).toFixed(2)} ${sizes[j]}`);
x += addDetailItem("Capacity", EscapeHtml(fsize), s);
}
if (m.available) {
var sizes = ['KB', 'MB', 'GB', 'TB'];
var j = parseInt(Math.floor(Math.log(Math.abs(m.available)) / Math.log(1024)), 10);
var fsize = (j === 0 ? `${m.available} ${sizes[j]}` : `${(m.available / (1024 ** j)).toFixed(2)} ${sizes[j]}`);
x += addDetailItem("Capacity Remaining", EscapeHtml(fsize), s);
}
if (m.type) {
var type = (m.removable == true ? "Removable" : (m.cdrom == true ? "CD-ROM" : ''));
x += addDetailItem("File System", (type != '' ? (type + ' / ') : '') + (m.type == 'Unknown' ? "Unknown" : EscapeHtml(m.type)), s);
}
x += '</div>';
}
if (x != '') { sections.push({ name: "Storage Volumes", html: '<table style=width:100%>' + x + '</table>', img: 'storage'}); }
}
// Render the sections
var x = '';
for (var i in sections) {

View file

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
@ -12268,6 +12268,35 @@
if (x != '') { sections.push({ name: "Storage Volumes", html: '<table style=width:100%>' + x + '</table>', img: 'storage64.png'}); }
}
// Linux Volumes
if (hardware.linux && hardware.linux.volumes) {
var x = '';
for (var i in hardware.linux.volumes) {
var m = hardware.linux.volumes[i];
if(m.mount_point.startsWith('/var/lib/docker/overlay2')) continue;
x += '<tr><td><div class=style10 style=border-radius:5px;padding:8px>';
x += '<div style=margin-bottom:3px><b>' + m.mount_point + '</b></div>';
if (m.size) {
var sizes = ['KB', 'MB', 'GB', 'TB'];
var j = parseInt(Math.floor(Math.log(Math.abs(m.size)) / Math.log(1024)), 10);
var fsize = (j === 0 ? `${m.size} ${sizes[j]}` : `${(m.size / (1024 ** j)).toFixed(2)} ${sizes[j]}`);
x += addDetailItem("Capacity", EscapeHtml(fsize), s);
}
if (m.available) {
var sizes = ['KB', 'MB', 'GB', 'TB'];
var j = parseInt(Math.floor(Math.log(Math.abs(m.available)) / Math.log(1024)), 10);
var fsize = (j === 0 ? `${m.available} ${sizes[j]}` : `${(m.available / (1024 ** j)).toFixed(2)} ${sizes[j]}`);
x += addDetailItem("Capacity Remaining", EscapeHtml(fsize), s);
}
if (m.type) {
var type = (m.removable == true ? "Removable" : (m.cdrom == true ? "CD-ROM" : ''));
x += addDetailItem("File System", (type != '' ? (type + ' / ') : '') + (m.type == 'Unknown' ? "Unknown" : EscapeHtml(m.type)), s);
}
x += '</div>';
}
if (x != '') { sections.push({ name: "Storage Volumes", html: '<table style=width:100%>' + x + '</table>', img: 'storage64.png'}); }
}
// Render the sections
var x = '';
for (var i in sections) {