Skip to content

Commit

Permalink
storcli.py: Skip battery backup unit status if it does not exist
Browse files Browse the repository at this point in the history
Some HPE RAID controllers have an external battery (Energy pack aka HPE Smart
Storage Battery) instead of a controller onboard battery backup unit. With our
controller (HPE MR416i-a Gen10+) the "BBU Status" field is not present in the
storcli output and storcli.py aborts data collection.

This commit skips the BBU Status field if it does not exist.
  • Loading branch information
bugspencor committed Dec 4, 2023
1 parent 3018120 commit 8ce52c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion storcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def handle_sas_controller(response):
def handle_megaraid_controller(response):
controller_index = response["Basics"]["Controller"]

if response["Status"]["BBU Status"] != "NA":
if "BBU Status" in response["Status"] and response["Status"]["BBU Status"] != "NA":
# BBU Status Optimal value is 0 for normal, 8 for charging.
metrics["bbu_healthy"].labels(controller_index).set(
response["Status"]["BBU Status"] in [0, 8, 4096]
Expand Down

0 comments on commit 8ce52c6

Please sign in to comment.