Skip to content

Commit

Permalink
overhaul smartd.conf template
Browse files Browse the repository at this point in the history
improve readability
sort megaraid device & disks
fix some whitespace issues
  • Loading branch information
Joshua Hoblitt committed May 16, 2013
1 parent bb34e2d commit 8f82a65
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions templates/smartd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ 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'] -%>
<% end #newline here, please %>
<% end -%>
<% end -%>
<% if @devicescan -%>
DEVICESCAN <% if @devicescan_options %><%= @devicescan_options %><% end %>
DEVICESCAN<% if @devicescan_options %><%= " " + @devicescan_options %><% end %>
<% end -%>

0 comments on commit 8f82a65

Please sign in to comment.