summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/pages/hints.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2024-12-18 18:22:35 +0100
committerSimon Rettberg2024-12-18 18:22:35 +0100
commit688236581f2f9904fa1f3acd8c5b4f37cd2296d7 (patch)
treefd01c7919454f5c073971378b1c97c393402eb02 /modules-available/statistics/pages/hints.inc.php
parent[statistics] Display/filter by firmware in client list (diff)
downloadslx-admin-master.tar.gz
slx-admin-master.tar.xz
slx-admin-master.zip
[statistics] Show ID45 size and local caching config in NIC speed hintHEADmaster
Diffstat (limited to 'modules-available/statistics/pages/hints.inc.php')
-rw-r--r--modules-available/statistics/pages/hints.inc.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/modules-available/statistics/pages/hints.inc.php b/modules-available/statistics/pages/hints.inc.php
index bfb28c24..18db10fe 100644
--- a/modules-available/statistics/pages/hints.inc.php
+++ b/modules-available/statistics/pages/hints.inc.php
@@ -173,9 +173,11 @@ class SubPage
$q->addMachineWhere('locationid', 'IN', $locs);
}
$q->addMachineWhere('lastseen', '>', strtotime('-60 days'));
+ $q->addMachineColumn('locationid');
$q->addMachineColumn('clientip');
$q->addMachineColumn('hostname');
$q->addMachineColumn('state');
+ $q->addMachineColumn('id45mb');
$q->addLocalColumn('nic-speed')->addCondition('<', 1000);
$q->addLocalColumn('nic-duplex');
foreach ($q->query() as $row) {
@@ -187,6 +189,45 @@ class SubPage
}
if (empty($list))
return;
+ if (Module::get('baseconfig') !== false) {
+ // Reconstruct config tree for each machine, so we can show the ID45 caching setting
+ $machineConfigs = Database::queryKeyValueList("SELECT machineuuid, value FROM setting_machine
+ WHERE setting = :setting
+ AND machineuuid IN (:uuids)", [
+ 'uuids' => array_column($list, 'machineuuid'),
+ 'setting' => 'SLX_DNBD3_MIN_GB',
+ ]);
+ $locationConfigs = Database::queryKeyValueList("SELECT locationid, value FROM setting_location
+ WHERE setting = :setting
+ AND locationid IN (:locationids)", [
+ 'locationids' => array_column($list, 'locationid'),
+ 'setting' => 'SLX_DNBD3_MIN_GB',
+ ]);
+ $default = Database::queryFirst("SELECT value FROM setting_global WHERE setting = :setting",
+ ['setting' => 'SLX_DNBD3_MIN_GB']);
+ if ($default !== false) {
+ $default = $default['value'];
+ }
+ foreach ($list as &$row) {
+ $val = null;
+ if (isset($machineConfigs[$row['machineuuid']])) {
+ $val = $machineConfigs[$row['machineuuid']];
+ } elseif ($row['locationid'] !== null) {
+ foreach (Location::getLocationRootChain($row['locationid']) as $lid) {
+ if (isset($locationConfigs[$lid])) {
+ $val = $locationConfigs[$lid];
+ break;
+ }
+ }
+ }
+ $row['id45gb'] = floor($row['id45mb'] / 1024);
+ $row['id45min'] = $val ?? $default;
+ if ($row['id45min'] == 0 || $row['id45min'] * 1024 > $row['id45mb']) {
+ $row['id45class'] = 'danger';
+ }
+ }
+ }
+ //
ArrayUtil::sortByColumn($list, 'hostname');
Render::addTemplate('hints-nic-speed', ['list' => $list]);
}