From ab9fbf17cc71d56a01ff82d26af13872b41e5112 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 13 Dec 2019 15:19:55 +0100 Subject: [statistics] Add NVMe support --- modules-available/statistics/inc/parser.inc.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules-available/statistics/inc') diff --git a/modules-available/statistics/inc/parser.inc.php b/modules-available/statistics/inc/parser.inc.php index 764d18c1..d697c733 100644 --- a/modules-available/statistics/inc/parser.inc.php +++ b/modules-available/statistics/inc/parser.inc.php @@ -348,7 +348,11 @@ class Parser { continue; } if (preg_match('/^([A-Z][^:]+):\s*(.*)$/', $line, $out)) { - $dev['s_' . preg_replace('/\s|-|_/', '', $out[1])] = $out[2]; + $key = preg_replace('/\s|-|_/', '', $out[1]); + if ($key === 'ModelNumber') { + $key = 'DeviceModel'; + } + $dev['s_' . $key] = $out[2]; } elseif (preg_match('/^\s*\d+\s+(\S+)\s+\S+\s+\d+\s+\d+\s+\S+\s+\S+\s+(\d+)(\s|$)/', $line, $out)) { $dev['s_' . preg_replace('/\s|-|_/', '', $out[1])] = $out[2]; } @@ -357,7 +361,7 @@ class Parser { foreach ($hdds as &$hdd) { if (isset($hdd['s_PowerOnHours'])) { $hdd['PowerOnTime'] = ''; - $val = (int)$hdd['s_PowerOnHours']; + $val = (int)str_replace('.', '', $hdd['s_PowerOnHours']); if ($val > 8760) { $hdd['PowerOnTime'] .= floor($val / 8760) . 'Y, '; $val %= 8760; -- cgit v1.2.3-55-g7522