Skip to content

Commit

Permalink
Extract drive temperature from storcli (#188)
Browse files Browse the repository at this point in the history
Expose physical drive temperature in degrees Celsius if available.

Signed-off-by: Jason Valdron <[email protected]>
  • Loading branch information
jValdron authored Nov 23, 2023
1 parent f5c56e7 commit 3018120
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions storcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 3018120

Please sign in to comment.