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

add lastbootuptime to columns and device powered on event (#5999)

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
Simon Smith 2024-04-07 19:12:01 +01:00 committed by GitHub
parent 31ebb21e0b
commit 548edd13d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 3075 additions and 3070 deletions

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" />
@ -4051,6 +4051,7 @@
x += '<label><input id=d2c11 type=checkbox' + ((deviceViewSettings.devsCols.indexOf('windowsav') >= 0)?' checked':'') + '>' + "Windows AV" + '</label><br />';
x += '<label><input id=d2c12 type=checkbox' + ((deviceViewSettings.devsCols.indexOf('windowsupdate') >= 0)?' checked':'') + '>' + "Windows Update" + '</label><br />';
x += '<label><input id=d2c13 type=checkbox' + ((deviceViewSettings.devsCols.indexOf('windowsfirewall') >= 0)?' checked':'') + '>' + "Windows Firewall" + '</label><br />';
x += '<label><input id=d2c14 type=checkbox' + ((deviceViewSettings.devsCols.indexOf('lastbootuptime') >= 0)?' checked':'') + '>' + "Last Boot Up Time" + '</label><br />';
x += '<label><input id=d2c1 type=checkbox' + ((deviceViewSettings.devsCols.indexOf('links') >= 0)?' checked':'') + '>' + "MeshCentral Router Links" + '</label><br />';
x += '<label><input id=d2c2 type=checkbox' + ((deviceViewSettings.devsCols.indexOf('user') >= 0)?' checked':'') + '>' + "Logged in users" + '</label><br />';
x += '<label><input id=d2c3 type=checkbox' + ((deviceViewSettings.devsCols.indexOf('ip') >= 0)?' checked':'') + '>' + "Agent IP address" + '</label><br />';
@ -4076,6 +4077,7 @@
if (Q('d2c11').checked) { cols.push('windowsav'); }
if (Q('d2c12').checked) { cols.push('windowsupdate'); }
if (Q('d2c13').checked) { cols.push('windowsfirewall'); }
if (Q('d2c14').checked) { cols.push('lastbootuptime'); }
if (Q('d2c15').checked) { cols.push('amthost'); }
if (Q('d2c17').checked) { cols.push('amtstate'); }
deviceViewSettings.devsCols = cols;
@ -4518,6 +4520,7 @@
if (deviceViewSettings.devsCols.indexOf('windowsav') >= 0) { colums += '<th style=color:gray;width:100px>' + "Windows AV"; }
if (deviceViewSettings.devsCols.indexOf('windowsupdate') >= 0) { colums += '<th style=color:gray;width:120px>' + "Windows Update"; }
if (deviceViewSettings.devsCols.indexOf('windowsfirewall') >= 0) { colums += '<th style=color:gray;width:120px>' + "Windows Firewall"; }
if (deviceViewSettings.devsCols.indexOf('lastbootuptime') >= 0) { colums += '<th style=color:gray;width:120px>' + "Last Boot Up Time"; }
if (deviceViewSettings.devsCols.indexOf('links') >= 0) { colums += '<th style=color:gray;width:120px>' + "Links"; }
if (deviceViewSettings.devsCols.indexOf('user') >= 0) { colums += '<th style=color:gray;width:120px>' + "User"; }
if (deviceViewSettings.devsCols.indexOf('ip') >= 0) { colums += '<th style=color:gray;width:120px>' + "Address"; }
@ -4832,6 +4835,9 @@
if (deviceViewSettings.devsCols.indexOf('windowsfirewall') >= 0) { // Windows Firewall
r += '<td style=text-align:center>' + ((node.wsc && node.wsc.firewall != null) ? (node.wsc.firewall == 'OK' ? "<span style=color:green>OK</span>" : "<span style=color:red>BAD</span>") : "");
}
if (deviceViewSettings.devsCols.indexOf('lastbootuptime') >= 0) { // Last Boot Up Time
r += '<td style=text-align:center;font-size:x-small>' + ((node.lastbootuptime != null) ? printDateTime(new Date(node.lastbootuptime)) : "");
}
if (deviceViewSettings.devsCols.indexOf('links') >= 0) { r += '<td style=text-align:center;font-size:x-small>' + getShortRouterLinks(node); } // Links
if (deviceViewSettings.devsCols.indexOf('user') >= 0) { r += '<td style=text-align:center>' + getUserShortStr(node); } // User
if (deviceViewSettings.devsCols.indexOf('ip') >= 0) { var ip = ''; if (node.mtype == 3) { ip = node.host; } else if (node.ip) { ip = node.ip; } r += '<td style=text-align:center>' + ip; } // IP address
@ -11928,28 +11934,12 @@
}
if(hardware.linux && hardware.linux.LastBootUpTime){
var lastBootUpTime = new Date(hardware.linux.LastBootUpTime);
var thedate = {
year: lastBootUpTime.getFullYear(),
month: lastBootUpTime.getMonth(),
day: lastBootUpTime.getDate(),
hours: lastBootUpTime.getHours(),
minutes: lastBootUpTime.getMinutes(),
seconds: lastBootUpTime.getSeconds()
};
const date = printDateTime(new Date(thedate.year, thedate.month, thedate.day, thedate.hours, thedate.minutes, thedate.seconds));
const date = printDateTime(lastBootUpTime);
x += addDetailItem("Last Boot Up Time", date);
}
if(hardware.darwin && hardware.darwin.LastBootUpTime){
var lastBootUpTime = new Date(hardware.darwin.LastBootUpTime * 1000); // must times by 1000 even tho timestamp is correct?
var thedate = {
year: lastBootUpTime.getFullYear(),
month: lastBootUpTime.getMonth(),
day: lastBootUpTime.getDate(),
hours: lastBootUpTime.getHours(),
minutes: lastBootUpTime.getMinutes(),
seconds: lastBootUpTime.getSeconds()
};
const date = printDateTime(new Date(thedate.year, thedate.month, thedate.day, thedate.hours, thedate.minutes, thedate.seconds));
const date = printDateTime(lastBootUpTime);
x += addDetailItem("Last Boot Up Time", date);
}
if (x != '') { sections.push({ name: "Operating System", html: x, img: 'software64.png'}); }
@ -15044,7 +15034,8 @@
155: "Denied user login from {0}, {1}, {2}",
156: "Verified messaging account of user {0}",
157: "Removed messaging account of user {0}",
158: "Displaying alert box, title=\"{0}\", message=\"{1}\""
158: "Displaying alert box, title=\"{0}\", message=\"{1}\"",
159: "Device Powered On"
};
var eventsShortMessageId = {