From 88c548546b034bbbea1e44cf548a265725049835 Mon Sep 17 00:00:00 2001 From: Jason Valdron Date: Thu, 23 Nov 2023 09:25:03 -0400 Subject: [PATCH] Extract drive temperature from storcli (#188) Expose physical drive temperature in degrees Celsius if available. Signed-off-by: Jason Valdron --- storcli.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/storcli.py b/storcli.py index 16a4e98..073b4a6 100755 --- a/storcli.py +++ b/storcli.py @@ -173,6 +173,11 @@ ], namespace=namespace, registry=registry, ), + "pd_temp": Gauge( + "pd_temp_celsius", + "MegaRAID physical drive temperature in degrees Celsius", + ["controller", "enclosure", "slot"], namespace=namespace, registry=registry, + ), # fmt: on } @@ -377,6 +382,11 @@ def create_metrics_of_physical_drive(physical_drive, detailed_info_array, contro attributes["Firmware Revision"].strip(), attributes["SN"].strip(), ).set(1) + + if "Drive Temperature" in state: + metrics["pd_temp"].labels(controller_index, enclosure, slot).set( + state["Drive Temperature"].split("C")[0].strip() + ) except KeyError: pass