Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some disks doesnt report device speed correctly, crashing script execution #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions storcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,15 @@ def create_metrics_of_physical_drive(physical_drive, detailed_info_array, contro
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]
)
# Some disks doesnt report device speed correctly
# when pd_device_speed metric assigns a string value: "Unknown"
# script execution crashes in that case assign a 0 speed value.
if attributes["Device Speed"].split(".")[0] == "Unknown":
metrics["pd_device_speed"].labels(controller_index, enclosure, slot).set('0')
else:
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