From e440e54e36a5a79555b7ff8275cc50138d8ea766 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 25 Sep 2023 15:25:02 +0200 Subject: [statistics] Add hints for old CPUs (to be implemented on client) --- .../eventlog/lang/de/template-tags.json | 1 + .../eventlog/lang/en/template-tags.json | 1 + .../statistics/inc/hardwareparser.inc.php | 7 +++++- .../statistics/lang/de/template-tags.json | 2 ++ .../statistics/lang/en/template-tags.json | 2 ++ modules-available/statistics/pages/hints.inc.php | 25 +++++++++++++++++++ .../statistics/templates/hints-cpu-legacy.html | 28 ++++++++++++++++++++++ 7 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 modules-available/statistics/templates/hints-cpu-legacy.html diff --git a/modules-available/eventlog/lang/de/template-tags.json b/modules-available/eventlog/lang/de/template-tags.json index df8e23d2..fd9cc532 100644 --- a/modules-available/eventlog/lang/de/template-tags.json +++ b/modules-available/eventlog/lang/de/template-tags.json @@ -5,6 +5,7 @@ "lang_autoJsonHelp": "Das Feld \"POST-Format\" wird ignoriert. Die POST-Daten sind eine JSON-Struktur mit allen zum Ereignis geh\u00f6renden Daten. Die Felder \"Betreff\" und \"Nachricht\" werden ebenfalls ignoriert.", "lang_copy": "Kopieren", "lang_createFilter": "Filter erstellen", + "lang_description": "Beschreibung", "lang_details": "Details", "lang_editFilter": "Filter bearbeiten", "lang_editMail": "EMail bearbeiten", diff --git a/modules-available/eventlog/lang/en/template-tags.json b/modules-available/eventlog/lang/en/template-tags.json index 55ebda89..7535b86b 100644 --- a/modules-available/eventlog/lang/en/template-tags.json +++ b/modules-available/eventlog/lang/en/template-tags.json @@ -5,6 +5,7 @@ "lang_autoJsonHelp": "The field \"POST format\" is ignored. The POST payload is a JSON struct with all available data regarding the according event. \"Subject\" and \"Message\" are ignored as well.", "lang_copy": "Copy", "lang_createFilter": "Create filter", + "lang_description": "Description", "lang_details": "Details", "lang_editFilter": "Edit filter", "lang_editMail": "Edit mail", diff --git a/modules-available/statistics/inc/hardwareparser.inc.php b/modules-available/statistics/inc/hardwareparser.inc.php index caa011d9..1c549976 100644 --- a/modules-available/statistics/inc/hardwareparser.inc.php +++ b/modules-available/statistics/inc/hardwareparser.inc.php @@ -338,6 +338,7 @@ class HardwareParser return null; } // determine misc stuff first + $globalCpuExtra = []; $globalMainboardExtra = []; $localMainboardExtra = []; // physical memory array @@ -425,6 +426,9 @@ class HardwareParser continue; $localMainboardExtra['cpu-' . $key] = $data['cpu'][$key]; } + if ($data['cpu']['vmx-legacy'] ?? false) { + $globalCpuExtra['vmx-legacy'] = 1; + } // Do the same hack with the primary NIC's speed and duplex. Even if it's not an onboard NIC, we only have one // primary boot interface $bootNic = $data['net']['boot0'] ?? $data['net']['eth0'] ?? null; @@ -457,7 +461,8 @@ class HardwareParser self::updateHwTypeFromDmi($uuid, $data, 4, HardwareInfo::CPU, ['Version'], ['Socket Designation'], ['Type', 'Family', 'Manufacturer', 'Signature', 'Version', 'Core Count', 'Thread Count'], // Global props, don't change - ['Voltage', 'Current Speed', 'Upgrade', 'Core Enabled']); + ['Voltage', 'Current Speed', 'Upgrade', 'Core Enabled'], + $globalCpuExtra); // Information about system slots self::updateHwTypeFromDmi($uuid, $data, 9, HardwareInfo::SYSTEM_SLOT, function (array &$entry): bool { diff --git a/modules-available/statistics/lang/de/template-tags.json b/modules-available/statistics/lang/de/template-tags.json index 46ac0fa3..064805c2 100644 --- a/modules-available/statistics/lang/de/template-tags.json +++ b/modules-available/statistics/lang/de/template-tags.json @@ -50,6 +50,8 @@ "lang_labelFilter": "Aktive Filter (UND-Logik)", "lang_lastBoot": "Letzter Boot", "lang_lastSeen": "Zuletzt gesehen", + "lang_legacyCpuVmx": "Veraltete CPU (VMware)", + "lang_legacyCpuVmxText": "Diese Rechner haben eine CPU, die von neueren VMware-Versionen nicht mehr unterst\u00fctzt wird. Um VMware-VMs auf diesen Rechnern zu nutzen, m\u00fcssen diese mit einem Grundsystem betrieben werden, welches noch den VMware Player 12.5.x enth\u00e4lt, z.B. 30r1. Bedenken Sie jedoch, dass \u00e4ltere Grundsysteme neuere bwLehrpool-Funktionen nicht enthalten, und somit in ihrer Funktionalit\u00e4t eingeschr\u00e4nkt sein k\u00f6nnen.", "lang_listDropdown": "Als Text", "lang_location": "Ort", "lang_logHeadline": "Logging", diff --git a/modules-available/statistics/lang/en/template-tags.json b/modules-available/statistics/lang/en/template-tags.json index fefb9bc3..03c5c312 100644 --- a/modules-available/statistics/lang/en/template-tags.json +++ b/modules-available/statistics/lang/en/template-tags.json @@ -50,6 +50,8 @@ "lang_labelFilter": "Active filters (AND logic)", "lang_lastBoot": "Last boot", "lang_lastSeen": "Last seen", + "lang_legacyCpuVmx": "Legacy CPU (VMware)", + "lang_legacyCpuVmxText": "These machines have CPUs that are not supported by recent VMware versions. To run VMware VMs on these machines, you need to switch to an older netboot system that still contains VMware Player 12.5.x, e.g. 30r1. Please keep in mind that those older versions lack newer bwLwlehrpool features, so using those might lead to functionality missing or being buggy.", "lang_listDropdown": "As text", "lang_location": "Location", "lang_logHeadline": "Logging", diff --git a/modules-available/statistics/pages/hints.inc.php b/modules-available/statistics/pages/hints.inc.php index 55dbca52..fbde5b45 100644 --- a/modules-available/statistics/pages/hints.inc.php +++ b/modules-available/statistics/pages/hints.inc.php @@ -14,6 +14,7 @@ class SubPage if (in_array(0, $locs)) { $locs = []; } + self::showLegacyCpu($locs); self::showMemoryUpgrade($locs); self::showSlowNics($locs); self::showUnusedSpace($locs); @@ -190,4 +191,28 @@ class SubPage Render::addTemplate('hints-nic-speed', ['list' => $list]); } + /** + * Show machines that have a CPU that is only supported by VMware 12.5.x, + * but not newer versions. + */ + private static function showLegacyCpu(array $locs) + { + $list = []; + $q = new HardwareQuery(HardwareInfo::CPU); + if (!empty($locs)) { + $q->addMachineWhere('locationid', 'IN', $locs); + } + $q->addMachineWhere('lastseen', '>', strtotime('-60 days')); + $q->addMachineColumn('clientip'); + $q->addMachineColumn('hostname'); + $q->addMachineColumn('state'); + $q->addMachineColumn('cpumodel'); + $q->addGlobalColumn('vmx-legacy')->addCondition('<>', 0); + $list = $q->query()->fetchAll(); + if (empty($list)) + return; + ArrayUtil::sortByColumn($list, 'hostname'); + Render::addTemplate('hints-cpu-legacy', ['list' => $list]); + } + } \ No newline at end of file diff --git a/modules-available/statistics/templates/hints-cpu-legacy.html b/modules-available/statistics/templates/hints-cpu-legacy.html new file mode 100644 index 00000000..44a5b166 --- /dev/null +++ b/modules-available/statistics/templates/hints-cpu-legacy.html @@ -0,0 +1,28 @@ +

{{lang_legacyCpuVmx}}

+ +

{{lang_legacyCpuVmxText}}

+ + + + + + + + + + {{#list}} + + + + + {{/list}} + +
{{lang_machine}}{{lang_cpuModel}}
+ + + {{hostname}}{{^hostname}}{{clientip}}{{/hostname}} + +
{{machineuuid}}
+
+ {{cpumodel}} +
\ No newline at end of file -- cgit v1.2.3-55-g7522