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) --- modules-available/statistics/pages/hints.inc.php | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'modules-available/statistics/pages') 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 -- cgit v1.2.3-55-g7522