Skip to content

Commit

Permalink
storcli.py: don't error out on unsupported features
Browse files Browse the repository at this point in the history
Signed-off-by: Pat Riehecky <[email protected]>
  • Loading branch information
jcpunk committed Jan 29, 2024
1 parent 3018120 commit 96a708a
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions storcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,27 +340,34 @@ def create_metrics_of_physical_drive(physical_drive, detailed_info_array, contro
attributes = info[drive_identifier + " Device attributes"]
settings = info[drive_identifier + " Policies/Settings"]

metrics["pd_shield_counter"].labels(controller_index, enclosure, slot).set(
state["Shield Counter"]
)
metrics["pd_media_errors"].labels(controller_index, enclosure, slot).set(
state["Media Error Count"]
)
metrics["pd_other_errors"].labels(controller_index, enclosure, slot).set(
state["Other Error Count"]
)
metrics["pd_predictive_errors"].labels(controller_index, enclosure, slot).set(
state["Predictive Failure Count"]
)
if state["Shield Counter"] != "N/A":
metrics["pd_shield_counter"].labels(controller_index, enclosure, slot).set(
state["Shield Counter"]
)
if state["Media Error Count"] != "N/A":
metrics["pd_media_errors"].labels(controller_index, enclosure, slot).set(
state["Media Error Count"]
)
if state["Other Error Count"] != "N/A":
metrics["pd_other_errors"].labels(controller_index, enclosure, slot).set(
state["Other Error Count"]
)
if state["Predictive Failure Count"] != "N/A":
metrics["pd_predictive_errors"].labels(controller_index, enclosure, slot).set(
state["Predictive Failure Count"]
)
metrics["pd_smart_alerted"].labels(controller_index, enclosure, slot).set(
state["S.M.A.R.T alert flagged by drive"] == "Yes"
)
metrics["pd_link_speed"].labels(controller_index, enclosure, slot).set(
attributes["Link Speed"].split(".")[0]
)
metrics["pd_device_speed"].labels(controller_index, enclosure, slot).set(
attributes["Device Speed"].split(".")[0]
)
if attributes["Link Speed"] != "Unknown":
metrics["pd_link_speed"].labels(controller_index, enclosure, slot).set(
attributes["Link Speed"].split(".")[0]
)
if attributes["Device Speed"] != "Unknown":
metrics["pd_device_speed"].labels(controller_index, enclosure, slot).set(
attributes["Device Speed"].split(".")[0]
)

metrics["pd_commissioned_spare"].labels(controller_index, enclosure, slot).set(
settings["Commissioned Spare"] == "Yes"
)
Expand Down

0 comments on commit 96a708a

Please sign in to comment.