summaryrefslogtreecommitdiffstats
path: root/modules-available
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
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')
-rw-r--r--modules-available/statistics/lang/de/template-tags.json2
-rw-r--r--modules-available/statistics/lang/en/template-tags.json2
-rw-r--r--modules-available/statistics/pages/hints.inc.php41
-rw-r--r--modules-available/statistics/templates/hints-nic-speed.html28
4 files changed, 73 insertions, 0 deletions
diff --git a/modules-available/statistics/lang/de/template-tags.json b/modules-available/statistics/lang/de/template-tags.json
index e22dc651..fc310592 100644
--- a/modules-available/statistics/lang/de/template-tags.json
+++ b/modules-available/statistics/lang/de/template-tags.json
@@ -54,6 +54,7 @@
"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. Da dies zunehmend technisch schwieriger wird, k\u00f6nnte dies f\u00fcr zuk\u00fcnftige Versionen des Grundsystems nicht mehr der Fall sein.",
"lang_listDropdown": "Als Text",
+ "lang_localCaching": "Lokales Caching",
"lang_location": "Ort",
"lang_logHeadline": "Logging",
"lang_macAddr": "MAC-Adresse",
@@ -70,6 +71,7 @@
"lang_maximumAbbrev": "Max.",
"lang_mediaIntegrityErrors": "\"Media Integrity Errors\"",
"lang_memoryStats": "Arbeitsspeicher",
+ "lang_minId45": "Minimum erforderlich",
"lang_mobomodel": "Mainboard",
"lang_modelCount": "Anzahl",
"lang_modelName": "Modellname",
diff --git a/modules-available/statistics/lang/en/template-tags.json b/modules-available/statistics/lang/en/template-tags.json
index 6f474c52..4233c53b 100644
--- a/modules-available/statistics/lang/en/template-tags.json
+++ b/modules-available/statistics/lang/en/template-tags.json
@@ -54,6 +54,7 @@
"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. As this gets technically challenging with newer releases, it's likely that at some point in the future we'll stop shipping the old player.",
"lang_listDropdown": "As text",
+ "lang_localCaching": "Local caching",
"lang_location": "Location",
"lang_logHeadline": "Logging",
"lang_macAddr": "MAC address",
@@ -70,6 +71,7 @@
"lang_maximumAbbrev": "max.",
"lang_mediaIntegrityErrors": "Media Integrity Errors",
"lang_memoryStats": "Memory",
+ "lang_minId45": "Minimum required",
"lang_mobomodel": "Mainboard",
"lang_modelCount": "Count",
"lang_modelName": "Model name",
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]);
}
diff --git a/modules-available/statistics/templates/hints-nic-speed.html b/modules-available/statistics/templates/hints-nic-speed.html
index 963213cd..d8ff4eef 100644
--- a/modules-available/statistics/templates/hints-nic-speed.html
+++ b/modules-available/statistics/templates/hints-nic-speed.html
@@ -8,6 +8,7 @@
<th>{{lang_machine}}</th>
<th>{{lang_nicSpeed}}</th>
<th>{{lang_nicDuplex}}</th>
+ <th colspan="3">{{lang_localCaching}}</th>
</tr>
</thead>
<tbody>
@@ -26,6 +27,33 @@
<td>
{{nic-duplex}}
</td>
+ <td class="{{id45class}} slx-smallcol">
+ <div>{{lang_id45size}}:</div>
+ <div>{{lang_minId45}}:</div>
+ </td>
+ <td class="{{id45class}} slx-smallcol text-right">
+ <div>{{id45gb}}&thinsp;GiB</div>
+ <div>{{id45min}}&thinsp;GiB</div>
+ </td>
+ <td class="slx-smallcol">
+ <div>
+ {{#locationid}}
+ <a href="?do=baseconfig&amp;module=locations&amp;locationid={{locationid}}&amp;redirect=%3Fdo%3Dstatistics%26show%3Dhints#SLX_DNBD3_MIN_GB">
+ <span class="glyphicon glyphicon-edit"></span>
+ {{lang_location}}
+ </a>
+ {{/locationid}}
+ {{^locationid}}
+ &nbsp;
+ {{/locationid}}
+ </div>
+ <div>
+ <a href="?do=baseconfig&amp;module=statistics&amp;machineuuid={{machineuuid}}&amp;redirect=%3Fdo%3Dstatistics%26show%3Dhints#SLX_DNBD3_MIN_GB">
+ <span class="glyphicon glyphicon-edit"></span>
+ {{lang_machine}}
+ </a>
+ </div>
+ </td>
</tr>
{{/list}}
</tbody>