diff options
Diffstat (limited to 'modules-available/statistics/pages')
-rw-r--r-- | modules-available/statistics/pages/hints.inc.php | 41 |
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]); } |