disk = nil
IO.popen(%w(ssacli controller all show config detail)).each do |line|
+ next unless line.valid_encoding?
+
if line =~ /^Smart (?:Array|HBA) (\S+) /
controller = {
:id => devices[:controllers].count,
elsif array && line =~ /^ Status:\s+(.*\S)\s*$/
case Regexp.last_match(1)
when "OK" then array[:status] = "optimal"
+ when "Interim Recovery Mode" then array[:status] = "degraded"
else array[:status] = "unknown"
end
elsif array && line =~ /^ (\S[^:]+):\s+(.*\S)\s*$/
if disk[:status] == "Failed"
disk[:status] = "failed"
+ elsif disk[:status] == "Predictive Failure"
+ disk[:status] = "failed"
elsif disk[:status] == "OK" && disk[:drive_type] == "Data Drive"
disk[:status] = "online"
elsif disk[:status] == "OK" && disk[:drive_type] == "Spare Drive"
disk[:status] = "hotspare"
+ elsif disk[:status] == "OK" && disk[:drive_type] == "Unassigned Drive"
+ disk[:status] = "unconfigured"
else
disk[:status] = "unknown"
end