bin/check-smart-status.rb in sensu-plugins-disk-checks-1.0.2 vs bin/check-smart-status.rb in sensu-plugins-disk-checks-1.0.3

- old
+ new

@@ -117,11 +117,11 @@ description: 'Process a debug file for testing', required: false # Main function # - def run # rubocop:disable all + def run @smart_attributes = JSON.parse(IO.read(File.dirname(__FILE__) + '/smart.json'), symbolize_names: true)[:smart][:attributes] @smart_debug = config[:debug] == 'on' # Set default threshold default_threshold = config[:defaults].split(',') @@ -181,10 +181,10 @@ if config[:overall] == 'on' && !output[dev].include?('SMART overall-health self-assessment test result: PASSED') criticals << "Overall health check failed on #{dev}" end # #YELLOW - output[dev].split("\n").each do |line| # rubocop:disable Style/Next + output[dev].split("\n").each do |line| fields = line.split if fields.size == 10 && fields[0].to_i != 0 && att_check_list.include?(fields[0].to_i) smart_att = @smart_attributes.find { |att| att[:id] == fields[0].to_i } att_value = fields[9].to_i att_value = send(smart_att[:read], att_value) unless smart_att[:read].nil?