From 5772f3eb28d72f38226cad88daeab43343360227 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 13 Mar 2015 10:47:19 +0000 Subject: [PATCH] Configure smartd for LSI MegaRAID disks --- cookbooks/hardware/recipes/default.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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" -- 2.43.2