From: Tom Hughes Date: Fri, 13 Mar 2015 10:47:19 +0000 (+0000) Subject: Configure smartd for LSI MegaRAID disks X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/5772f3eb28d72f38226cad88daeab43343360227 Configure smartd for LSI MegaRAID disks --- diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 05d5c0794..eac54e764 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -267,6 +267,24 @@ if status_packages["cciss-vol-status"] end end +if status_packages["megaclisas-status"] + controller = 0 + + Dir.glob("/sys/class/scsi_host/host*") do |host| + driver = File.new("#{host}/proc_name").read.chomp + + next unless driver == "megaraid_sas" + + device = host.sub("/sys/class/scsi_host/host", "bus/") + + IO.popen(["megacli", "-PDList", "-a#{controller}", "-NoLog"]).each do |line| + disks << { :device => device, :driver => "megaraid", :id => Regexp.last_match[1] } if line =~ /^Device Id: ([0-9]+)$/ + end + + controller += 1 + end +end + if disks.count > 0 package "smartmontools"