]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/templates/default/ohai.rb.erb
Fix monitoring of devices behind adaptec RAID cards
[chef.git] / cookbooks / hardware / templates / default / ohai.rb.erb
index 7757dca80d0f70f9132d02a00048eab2462a385e..d223fa0c3c62e59fc69b80d7de2776eaa690c58c 100644 (file)
@@ -440,10 +440,12 @@ Ohai.plugin(:Hardware) do
       elsif disk && line =~ /^Firmware state:\s+(.*\S)\s*$/
         Regexp.last_match(1).split(/,\s*/).each do |state|
           case state
+          when "Unconfigured(bad)" then disk[:status] = "unconfigured"
           when "Online" then disk[:status] = "online"
           when "Hotspare" then disk[:status] = "hotspare"
-          when "Spun Up" then disk[:spun_down] = false
-          when "Spun down" then disk[:spun_down] = true
+          when "Failed" then disk[:status] = "failed"
+          when "Spun Up" then disk[:state] = "spun_up"
+          when "Spun down" then disk[:state] = "spun_down"
           end
         end
       elsif disk && line =~ /^(\S.*\S)\s*:\s+(\S.*)$/
@@ -479,8 +481,10 @@ Ohai.plugin(:Hardware) do
       elsif disk && line =~ /^Firmware state:\s+(.*\S)\s*$/
         Regexp.last_match(1).split(/,\s*/).each do |state|
           case state
+          when "Unconfigured(bad)" then disk[:status] = "unconfigured"
           when "Online" then disk[:status] = "online"
           when "Hotspare" then disk[:status] = "hotspare"
+          when "Failed" then disk[:status] = "failed"
           when "Spun Up" then disk[:state] = "spun_up"
           when "Spun down" then disk[:state] = "spun_down"
           end
@@ -762,10 +766,11 @@ Ohai.plugin(:Hardware) do
         array[:disks].map! do |location|
           disk = disks.find { |disk| disk[:location] == location }
 
+          controller_number = controller[:number] - 1
           device_number = disk[:device_number]
-          device = Dir.glob("#{host}/device/target*:1:#{device_number}/*:1:#{device_number}:0/scsi_generic/*").first
 
           disk[:device] = "/dev/#{File.basename(device)}"
+          disk[:smart_device] = "aacraid,#{controller_number},0,#{device_number}"
 
           disk[:arrays] << array[:id]
           disk[:id]