Skip to content

Commit

Permalink
Check if temperature is a number (see prometheus-community#197)
Browse files Browse the repository at this point in the history
Signed-off-by: yoan mueller <[email protected]>
  • Loading branch information
LuminatiHD committed Dec 22, 2023
1 parent 3018120 commit 709ce32
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions storcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,11 @@ def create_metrics_of_physical_drive(physical_drive, detailed_info_array, contro
).set(1)

if "Drive Temperature" in state:
metrics["pd_temp"].labels(controller_index, enclosure, slot).set(
state["Drive Temperature"].split("C")[0].strip()
)
temperature = state["Drive Temperature"].split("C")[0].strip()
if temperature.isnumeric():
metrics["pd_temp"].labels(controller_index, enclosure, slot).set(
temperature
)
except KeyError:
pass

Expand Down

0 comments on commit 709ce32

Please sign in to comment.