bin/check-smart-status.rb in sensu-plugins-disk-checks-1.1.3 vs bin/check-smart-status.rb in sensu-plugins-disk-checks-2.0.0

- old
+ new

@@ -130,11 +130,11 @@ @smart_attributes = JSON.parse(IO.read(config[:json]), symbolize_names: true)[:smart][:attributes] @smart_debug = config[:debug] == 'on' # Set default threshold default_threshold = config[:defaults].split(',') - fail 'Invalid default threshold parameter count' unless default_threshold.size == 4 + raise 'Invalid default threshold parameter count' unless default_threshold.size == 4 @smart_attributes.each do |att| att[:crit_min] = default_threshold[0].to_i if att[:crit_min].nil? att[:warn_min] = default_threshold[1].to_i if att[:warn_min].nil? att[:warn_max] = default_threshold[2].to_i if att[:warn_max].nil? att[:crit_max] = default_threshold[3].to_i if att[:crit_max].nil? @@ -142,11 +142,11 @@ # Check threshold parameter if present unless config[:threshold].nil? thresholds = config[:threshold].split(',') # Check threshold parameter length - fail 'Invalid threshold parameter count' unless thresholds.size % 5 == 0 + raise 'Invalid threshold parameter count' unless thresholds.size % 5 == 0 (0..(thresholds.size / 5 - 1)).each do |i| att_id = @smart_attributes.index { |att| att[:id] == thresholds[i + 0].to_i } thash = { crit_min: thresholds[i + 1].to_i, warn_min: thresholds[i + 2].to_i, @@ -201,10 +201,10 @@ puts "#{fields[0]} #{smart_att[:name]}: #{att_value} (critical)" if @smart_debug elsif att_value < smart_att[:warn_min] || att_value > smart_att[:warn_max] warnings << "#{dev} warning #{fields[0]} #{smart_att[:name]}: #{att_value}" puts "#{fields[0]} #{smart_att[:name]}: #{att_value} (warning)" if @smart_debug else - puts "#{fields[0]} #{smart_att[:name]}: #{att_value} (ok)" if @smart_debug + puts "#{fields[0]} #{smart_att[:name]}: #{att_value} (ok)" if @smart_debug # rubocop:disable Style/IfInsideElse end end end puts "\n\n" if @smart_debug end