From 39497a2930e4adf222cb2446ae70c45b81ccb034 Mon Sep 17 00:00:00 2001 From: jaspals3123 Date: Tue, 27 Jan 2026 14:23:55 -0600 Subject: [PATCH 1/2] collector parsing enhancement --- .../plugins/inband/dimm/dimm_collector.py | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/nodescraper/plugins/inband/dimm/dimm_collector.py b/nodescraper/plugins/inband/dimm/dimm_collector.py index a3ee84ee..4fd51dd8 100644 --- a/nodescraper/plugins/inband/dimm/dimm_collector.py +++ b/nodescraper/plugins/inband/dimm/dimm_collector.py @@ -23,6 +23,7 @@ # SOFTWARE. # ############################################################################### +import re from typing import Optional from nodescraper.base import InBandDataCollector @@ -97,25 +98,28 @@ def collect_data( if res.exit_code == 0: total = 0 topology = {} - size = None - for d in res.stdout.splitlines(): - split = d.split() - size = split[2] - key = split[1] + split[2] - if not topology.get(key, None): - topology[key] = 1 - else: - topology[key] += 1 - num_gb = int(split[1]) - total += num_gb + size = "" + dimm_size_pattern = re.compile(r"Size:\s+(\d+)\s+([A-Za-z]+)") + matches = dimm_size_pattern.findall(res.stdout) + if matches: + for match in matches: + size = match[1] + total += int(match[0]) + key = match[0] + match[1] + if not topology.get(key, None): + topology[key] = 1 + else: + topology[key] += 1 topology["total"] = total topology["size"] = size total_gb = topology.pop("total") size = topology.pop("size") - dimm_str = str(total_gb) + size + " @" - for size, count in topology.items(): - dimm_str += f" {count} x {size}" - + if total_gb == 0: + dimm_str = "0 GB" + else: + dimm_str = str(total_gb) + size + " @ " + for k, v in topology.items(): + dimm_str += str(v) + " x " + k if res.exit_code != 0: self._log_event( category=EventCategory.OS, From c01872e1743ff05f314af1e13eea04e68d9ef965 Mon Sep 17 00:00:00 2001 From: jaspals3123 Date: Tue, 27 Jan 2026 15:06:02 -0600 Subject: [PATCH 2/2] format structure fix --- nodescraper/plugins/inband/dimm/dimm_collector.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nodescraper/plugins/inband/dimm/dimm_collector.py b/nodescraper/plugins/inband/dimm/dimm_collector.py index 4fd51dd8..b6b91987 100644 --- a/nodescraper/plugins/inband/dimm/dimm_collector.py +++ b/nodescraper/plugins/inband/dimm/dimm_collector.py @@ -117,9 +117,8 @@ def collect_data( if total_gb == 0: dimm_str = "0 GB" else: - dimm_str = str(total_gb) + size + " @ " - for k, v in topology.items(): - dimm_str += str(v) + " x " + k + dimm_entries = [f"{v} x {k}" for k, v in topology.items()] + dimm_str = f"{total_gb}{size} @ {' '.join(dimm_entries)}" if res.exit_code != 0: self._log_event( category=EventCategory.OS,