bin/check-smart-status.rb in sensu-plugins-disk-checks-5.0.1 vs bin/check-smart-status.rb in sensu-plugins-disk-checks-5.1.0

- old
+ new

@@ -1,6 +1,8 @@ #! /usr/bin/env ruby +# frozen_string_literal: true + # # check-smart # # DESCRIPTION: # S.M.A.R.T. - Self-Monitoring, Analysis and Reporting Technology @@ -80,10 +82,11 @@ end end def smart_ignore?(num) return if @att_ignore.nil? + @att_ignore.include? num end public :device_path, :smart_ignore? end @@ -161,9 +164,10 @@ @hardware = JSON.parse(IO.read(config[:json]), symbolize_names: true)[:hardware][:devices] # Set default threshold default_threshold = config[:defaults].split(',') 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?