From cc34ad682798dc93023b650b077f04c1ecfdecd7 Mon Sep 17 00:00:00 2001 From: Jason Valdron Date: Wed, 22 Nov 2023 08:50:40 -0400 Subject: [PATCH] Extract drive temperature from storcli Signed-off-by: Jason Valdron --- storcli.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/storcli.py b/storcli.py index 16a4e98..8ecb516 100755 --- a/storcli.py +++ b/storcli.py @@ -155,6 +155,11 @@ "MegaRAID physical drive emergency spare", ["controller", "enclosure", "slot"], namespace=namespace, registry=registry, ), + "pd_temperature": Gauge( + "pd_temperature", + "MegaRAID physical drive temperature", + ["controller", "enclosure", "slot"], namespace=namespace, registry=registry, + ), "pd_info": Gauge( "pd_info", "MegaRAID physical drive info", @@ -344,6 +349,10 @@ def create_metrics_of_physical_drive(physical_drive, detailed_info_array, contro metrics["pd_other_errors"].labels(controller_index, enclosure, slot).set( state["Other Error Count"] ) + if "Drive Temperature" in state: + metrics["pd_temperature"].labels(controller_index, enclosure, slot).set( + state["Drive Temperature"].split("C")[0].strip() + ) metrics["pd_predictive_errors"].labels(controller_index, enclosure, slot).set( state["Predictive Failure Count"] )