diff options
author | Simon Rettberg | 2022-04-13 12:49:41 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-04-13 12:49:41 +0200 |
commit | f0ef328db5fc34db87070dc83e3af9d382a74eed (patch) | |
tree | 659ddf697a91daf947b47f0eeda3627ce6929b9f /modules-available/statistics/pages | |
parent | [inc/Database] Force more sql_mode options in debug mode (diff) | |
download | slx-admin-f0ef328db5fc34db87070dc83e3af9d382a74eed.tar.gz slx-admin-f0ef328db5fc34db87070dc83e3af9d382a74eed.tar.xz slx-admin-f0ef328db5fc34db87070dc83e3af9d382a74eed.zip |
[statistics] Add PCI device filter option
Diffstat (limited to 'modules-available/statistics/pages')
-rw-r--r-- | modules-available/statistics/pages/list.inc.php | 4 | ||||
-rw-r--r-- | modules-available/statistics/pages/machine.inc.php | 8 | ||||
-rw-r--r-- | modules-available/statistics/pages/summary.inc.php | 5 |
3 files changed, 11 insertions, 6 deletions
diff --git a/modules-available/statistics/pages/list.inc.php b/modules-available/statistics/pages/list.inc.php index d3c8069e..4d4da2b6 100644 --- a/modules-available/statistics/pages/list.inc.php +++ b/modules-available/statistics/pages/list.inc.php @@ -36,14 +36,14 @@ class SubPage if (Module::isAvailable('runmode')) { $xtra .= ', runmode.module AS rmmodule, runmode.isclient'; if (strpos($join, 'runmode') === false) { - $join .= ' LEFT JOIN runmode USING (machineuuid) '; + $join .= ' LEFT JOIN runmode ON (m.machineuuid = runmode.machineuuid) '; } } $res = Database::simpleQuery("SELECT m.machineuuid, m.locationid, m.macaddr, m.clientip, m.lastseen, m.logintime, m.state, m.currentuser, m.currentrunmode, m.realcores, m.mbram, m.kvmstate, m.cpumodel, m.id44mb, m.hostname, m.notes IS NOT NULL AS hasnotes, m.badsectors, Count(s.machineuuid) AS confvars $xtra FROM machine m - LEFT JOIN setting_machine s USING (machineuuid) + LEFT JOIN setting_machine s ON (m.machineuuid = s.machineuuid) $join WHERE $where GROUP BY m.machineuuid", $args); $rows = array(); $singleMachine = 'none'; diff --git a/modules-available/statistics/pages/machine.inc.php b/modules-available/statistics/pages/machine.inc.php index 4e8f9f34..0d91b017 100644 --- a/modules-available/statistics/pages/machine.inc.php +++ b/modules-available/statistics/pages/machine.inc.php @@ -508,11 +508,15 @@ class SubPage $hdd[$row['prop']] = $row['numeric'] ?? $row['value']; } } + $result = []; foreach ($hdds as $k => &$hdd) { + if (substr($hdd['dev'] ?? '/dev/sr', 0, 7) === '/dev/sr') + continue; $hdd['devid'] = 'k' . $k; $hdd['partitions'] = array_values($hdd['partitions']); + $result[] = $hdd; } - return array_values($hdds); + return $result; } private static function mangleHdd(array &$hdd) @@ -702,4 +706,4 @@ class SubPage return HardwareInfo::GPT[$type] ?? $type; } -}
\ No newline at end of file +} diff --git a/modules-available/statistics/pages/summary.inc.php b/modules-available/statistics/pages/summary.inc.php index 4599b8b6..1adad7bd 100644 --- a/modules-available/statistics/pages/summary.inc.php +++ b/modules-available/statistics/pages/summary.inc.php @@ -247,8 +247,9 @@ class SubPage $filterSet->makeFragments($where, $join, $args); $args['cutoff'] = ceil(time() / 3600) * 3600 - 86400 * 10; - $res = Database::simpleQuery("SELECT machineuuid, clientip, hostname, firstseen, mbram, kvmstate, id44mb FROM machine m $join" - . " WHERE firstseen > :cutoff AND $where ORDER BY firstseen DESC LIMIT 32", $args); + $res = Database::simpleQuery("SELECT m.machineuuid, m.clientip, m.hostname, m.firstseen, m.mbram, m.kvmstate, m.id44mb + FROM machine m $join + WHERE firstseen > :cutoff AND $where ORDER BY firstseen DESC LIMIT 32", $args); $rows = array(); $count = 0; foreach ($res as $row) { |