diff options
author | Simon Rettberg | 2023-05-11 10:03:10 +0200 |
---|---|---|
committer | Simon Rettberg | 2023-05-11 10:03:10 +0200 |
commit | 2b86d1dde730cdc19bf05adaa012ba6b9d767b85 (patch) | |
tree | 9b352d925d898c96bd11b0400931574bae6ff741 /modules-available/statistics/inc | |
parent | [statistics] Fix system model filter (diff) | |
download | slx-admin-2b86d1dde730cdc19bf05adaa012ba6b9d767b85.tar.gz slx-admin-2b86d1dde730cdc19bf05adaa012ba6b9d767b85.tar.xz slx-admin-2b86d1dde730cdc19bf05adaa012ba6b9d767b85.zip |
[statistics] Add filter for HDD rpm
Diffstat (limited to 'modules-available/statistics/inc')
-rw-r--r-- | modules-available/statistics/inc/hardwareparser.inc.php | 2 | ||||
-rw-r--r-- | modules-available/statistics/inc/statisticsfilter.inc.php | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/modules-available/statistics/inc/hardwareparser.inc.php b/modules-available/statistics/inc/hardwareparser.inc.php index f7a6545b..83a0d752 100644 --- a/modules-available/statistics/inc/hardwareparser.inc.php +++ b/modules-available/statistics/inc/hardwareparser.inc.php @@ -109,7 +109,7 @@ class HardwareParser } // Count, size (unitless) if (is_numeric($val) && preg_match('/^-?[0-9]+$/', $val) - && preg_match('/used|occupied|count|number|speed|width|size|capacity|temperature|_start|_value|_thresh|_worst|_time/', $key)) { + && preg_match('/used|occupied|count|number|speed|width|size|capacity|temperature|_start|_value|_thresh|_worst|_time|_rate/', $key)) { return (int)$val; } // Date diff --git a/modules-available/statistics/inc/statisticsfilter.inc.php b/modules-available/statistics/inc/statisticsfilter.inc.php index 55e88880..7b00fb12 100644 --- a/modules-available/statistics/inc/statisticsfilter.inc.php +++ b/modules-available/statistics/inc/statisticsfilter.inc.php @@ -278,6 +278,7 @@ abstract class StatisticsFilter 'standbycrash' => new StandbyCrashStatisticsFilter(), 'pcidev' => new PciDeviceStatisticsFilter(), 'nicspeed' => new NicSpeedStatisticsFilter(), + 'hddrpm' => new HddRpmStatisticsFilter(), //'anydev' => new AnyHardwarePropStatisticsFilter(), ]; if (Module::isAvailable('locations')) { @@ -731,6 +732,26 @@ class NicSpeedStatisticsFilter extends StatisticsFilter } +class HddRpmStatisticsFilter extends StatisticsFilter +{ + + public function __construct() + { + parent::__construct(null, StatisticsFilter::OP_ORDINAL, '7200'); + } + + public function whereClause(string $operator, $argument, array &$args, array &$joins): string + { + $shw = StatisticsFilter::addHardwareJoin($args, $joins, HardwareInfo::HDD); + $_ = []; + $c = new HardwareQueryColumn(true, 'rotation_rate'); + $c->addCondition($operator, $argument); + $c->generate($joins, $_, $args, [], $shw); + return '1'; + } + +} + class SystemModelStatisticsFilter extends StatisticsFilter { |