summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/pages
diff options
context:
space:
mode:
authorSimon Rettberg2022-10-31 12:51:13 +0100
committerSimon Rettberg2022-10-31 12:51:13 +0100
commit332d307fa855bf01779765e1f974c6524c26f592 (patch)
treeb9f4e59a967a547f63f2d8113a5d9a1d344f2c4d /modules-available/statistics/pages
parent[serversetup-bwlp-ipxe] Encode ipxe script depending on iPXE version (diff)
downloadslx-admin-332d307fa855bf01779765e1f974c6524c26f592.tar.gz
slx-admin-332d307fa855bf01779765e1f974c6524c26f592.tar.xz
slx-admin-332d307fa855bf01779765e1f974c6524c26f592.zip
[statistics] Deal with broken HDDs that lead to incomplete data
We had a machine with a broken HDD that showed up as /dev/sda but didn't do much else, confusing tools like lsblk and fdisk, and ultimately leading to incomplete data in our DB that would make PHP freak out too much about missing array indices and wrong types.
Diffstat (limited to 'modules-available/statistics/pages')
-rw-r--r--modules-available/statistics/pages/machine.inc.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules-available/statistics/pages/machine.inc.php b/modules-available/statistics/pages/machine.inc.php
index b6c1f53c..1e00b8f2 100644
--- a/modules-available/statistics/pages/machine.inc.php
+++ b/modules-available/statistics/pages/machine.inc.php
@@ -551,6 +551,9 @@ class SubPage
private static function mangleHdd(array &$hdd)
{
static $hddidx = 0;
+ if (!isset($hdd['size']) || !is_numeric($hdd['size'])) {
+ $hdd['size'] = 0;
+ }
$hdd['hddidx'] = $hddidx++;
$hours = $hdd['power_on_time//hours'] ?? $hdd['attr_9']['raw'] ?? $hdd['power_on_hours']
?? $hdd['power_on_time']['hours'] ?? null;