summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/pages
diff options
context:
space:
mode:
authorSimon Rettberg2022-06-15 13:45:58 +0200
committerSimon Rettberg2022-06-15 13:45:58 +0200
commit496ac9b9680acae777dbd207858c874a7fcec252 (patch)
treeb766cd236318cf3355e581aa4b0def3c753e88de /modules-available/statistics/pages
parent[statistics] Make CPU and system model clickable in machine details (diff)
downloadslx-admin-496ac9b9680acae777dbd207858c874a7fcec252.tar.gz
slx-admin-496ac9b9680acae777dbd207858c874a7fcec252.tar.xz
slx-admin-496ac9b9680acae777dbd207858c874a7fcec252.zip
[statistics] Show clients with < gigabit ethernet in hints
Diffstat (limited to 'modules-available/statistics/pages')
-rw-r--r--modules-available/statistics/pages/hints.inc.php45
1 files changed, 37 insertions, 8 deletions
diff --git a/modules-available/statistics/pages/hints.inc.php b/modules-available/statistics/pages/hints.inc.php
index 6ef2490e..5092157c 100644
--- a/modules-available/statistics/pages/hints.inc.php
+++ b/modules-available/statistics/pages/hints.inc.php
@@ -15,8 +15,9 @@ class SubPage
$locs = [];
}
self::showMemoryUpgrade($locs);
- self::showMemorySlow($locs);
+ self::showSlowNics($locs);
self::showUnusedSpace($locs);
+ self::showMemorySlow($locs);
}
/**
@@ -34,8 +35,7 @@ class SubPage
$q->addGlobalColumn('Memory Maximum Capacity');
$q->addMachineColumn('clientip');
$q->addMachineColumn('hostname');
- $col = $q->addLocalColumn('Memory Installed Capacity');
- $col->addCondition('<', 8 * 1024 * 1024 * 1024);
+ $q->addLocalColumn('Memory Installed Capacity')->addCondition('<', 8 * 1024 * 1024 * 1024);
$list = [];
foreach ($q->query() as $row) {
if (HardwareParser::convertSize($row['Memory Installed Capacity'], 'M', false)
@@ -49,6 +49,8 @@ class SubPage
$list[] = $row;
}
}
+ if (empty($list))
+ return;
Render::addTemplate('hints-ram-upgrade', ['list' => $list]);
}
@@ -62,8 +64,8 @@ class SubPage
if (!empty($locs)) {
$q->addMachineWhere('locationid', 'IN', $locs);
}
- $q->addLocalColumn('Locator');
- $q->addLocalColumn('Bank Locator');
+ //$q->addLocalColumn('Locator');
+ //$q->addLocalColumn('Bank Locator');
$q->addGlobalColumn('Form Factor');
$q->addGlobalColumn('Type');
$q->addGlobalColumn('Size');
@@ -73,7 +75,9 @@ class SubPage
$q->addMachineColumn('hostname');
$col = $q->addGlobalColumn('Speed');
$col->addCondition('>', $q->addLocalColumn('Configured Memory Speed'));
- $list = $q->query()->fetchAll();
+ $list = $q->query(['machineuuid', 'Size', 'Manufacturer', 'Speed', 'Configured Memory Speed'])->fetchAll();
+ if (empty($list))
+ return;
Render::addTemplate('hints-ram-underclocked', ['list' => $list]);
}
@@ -93,7 +97,7 @@ class SubPage
$q->addMachineColumn('hostname');
$q->addLocalColumn('unused')->addCondition('>', 2000000000); // 2 GB
$q->addMachineWhere('id44mb', '<', 20000); // 20 GB
- foreach ($q->query()->fetchAll() as $row) {
+ foreach ($q->query() as $row) {
$row['unused_s'] = Util::readableFileSize($row['unused']);
$row['id44mb_s'] = Util::readableFileSize($row['id44mb'], -1, 2);
$id44[] = $row;
@@ -110,16 +114,41 @@ class SubPage
$q->addMachineWhere('id45mb', '<', 20000); // 20 GB
// Only suggest SSD based systems, caching on spinning rust is usually slower than GBit
$q->addGlobalColumn('rotation_rate')->addCondition('=', 0);
- foreach ($q->query()->fetchAll() as $row) {
+ foreach ($q->query() as $row) {
$row['unused_s'] = Util::readableFileSize($row['unused']);
$row['id44mb_s'] = Util::readableFileSize($row['id44mb'], -1, 2);
$row['id45mb_s'] = Util::readableFileSize($row['id45mb'], -1, 2);
$id45[] = $row;
}
+ if (empty($id44) && empty($id45))
+ return;
Render::addTemplate('hints-hdd-grow', [
'id44' => $id44,
'id45' => $id45,
]);
}
+ private static function showSlowNics(array $locs)
+ {
+ $list = [];
+ $q = new HardwareQuery(HardwareInfo::MAINBOARD);
+ if (!empty($locs)) {
+ $q->addMachineWhere('locationid', 'IN', $locs);
+ }
+ $q->addMachineColumn('clientip');
+ $q->addMachineColumn('hostname');
+ $q->addLocalColumn('nic-speed')->addCondition('<', 1000);
+ $q->addLocalColumn('nic-duplex');
+ foreach ($q->query() as $row) {
+ if ($row['nic-speed'] == 0) {
+ $row['nic-speed'] = '???';
+ }
+ $list[] = $row;
+ }
+ if (empty($list))
+ return;
+ ArrayUtil::sortByColumn($list, 'nic-speed', SORT_ASC | SORT_NUMERIC);
+ Render::addTemplate('hints-nic-speed', ['list' => $list]);
+ }
+
} \ No newline at end of file