diff --git a/templates/smartd.conf b/templates/smartd.conf index 3a30df7..d05804a 100644 --- a/templates/smartd.conf +++ b/templates/smartd.conf @@ -6,15 +6,17 @@ DEFAULT -m <%= @mail_to %> -M <%= @warning_schedule %> <%= @device_opts[device] -%> <% end #newline here, please %> <% end -%> -<% megaraid_adapters = scope.lookupvar('::megaraid_adapters') -megaraid_device = scope.lookupvar('::megaraid_virtual_drives') -megaraid_drives = scope.lookupvar('::megaraid_physical_drives') -megaraid_device = megaraid_device == :undefined ? "" : megaraid_device.split(/,/)[0] -megaraid_drives = megaraid_drives == :undefined ? [] : megaraid_drives.split(/,/) +<% +# it doesn't matter which megaraid block device we use to poll as long as all +# of the disks are attached to the same phyiscal controller. We're just +# picking the first one here. +if @megaraid_virtual_drives and @megaraid_virtual_drives != '' + megaraid_device = @megaraid_virtual_drives.split(/,/).sort[0] +end if megaraid_device and megaraid_device != '' and - megaraid_adapters and megaraid_adapters.to_i > 0 -%> -<% megaraid_drives.each do |drive| -%> + @megaraid_adapters and @megaraid_adapters.to_i > 0 + @megaraid_physical_drives.split(/,/).sort.each do |drive| -%> <%= megaraid_device %> -d sat+megaraid,<%= drive.to_i %> <% if @device_opts.has_key?('megaraid') -%> <%= @device_opts['megaraid'] -%> @@ -22,5 +24,5 @@ if megaraid_device and megaraid_device != '' and <% end -%> <% end -%> <% if @devicescan -%> -DEVICESCAN <% if @devicescan_options %><%= @devicescan_options %><% end %> +DEVICESCAN<% if @devicescan_options %><%= " " + @devicescan_options %><% end %> <% end -%>