]> git.openstreetmap.org Git - chef.git/commitdiff
Fix monitoring of devices behind adaptec RAID cards
authorTom Hughes <tom@compton.nu>
Tue, 27 Oct 2020 19:56:38 +0000 (19:56 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 27 Oct 2020 20:07:55 +0000 (20:07 +0000)
cookbooks/hardware/recipes/default.rb
cookbooks/hardware/templates/default/ohai.rb.erb

index 8a2a35e20febcc06bb5eaab77a67a8f3e3d27619..e8f903f64cc8a255aedcc127fae666f85a42b89d 100644 (file)
@@ -380,6 +380,13 @@ disks = disks.map do |disk|
       elsif smart =~ %r{^.*,(\d+)/(\d+)$}
         munin = "#{device}-#{Regexp.last_match(1)}:#{Regexp.last_match(2)}"
       end
+    elsif disk[:device]
+      device = disk[:device].sub("/dev/", "")
+      smart = disk[:smart_device]
+
+      if smart =~ /^.*,(\d+),(\d+),(\d+)$/
+        munin = "#{device}-#{Regexp.last_match(1)}:#{Regexp.last_match(2)}:#{Regexp.last_match(3)}"
+      end
     end
   elsif disk[:device] =~ %r{^/dev/(nvme\d+)n\d+$}
     device = Regexp.last_match(1)
index 82194acf29769c5cbd7405c81c4d8107505e5898..d223fa0c3c62e59fc69b80d7de2776eaa690c58c 100644 (file)
@@ -766,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]