app/models/my_nagios/check.rb in my_nagios-0.0.17 vs app/models/my_nagios/check.rb in my_nagios-0.0.18
- old
+ new
@@ -7,11 +7,12 @@
scope :enabled, -> { where(enabled: true) }
attr_accessor :additional_command_result
- INFO_STATES = ['AuthenticationFailed message', 'No such file or directory']
+ INFO_STATES = ['AuthenticationFailed message', 'No such file or directory']
+ ERROR_STATES = ['!ruby/exception', 'packet_write_wait: Connection to UNKNOWN: Broken pipe']
def run!
begin
self.update(state: :running)
@@ -44,10 +45,10 @@
check.update(state: :completed, status: status, latest_state: result, latest_updated_at: Time.now)
end
end
rescue => e
- check_list.update_all(state: :completed, status: :info, latest_state: e, latest_updated_at: Time.now)
+ check_list.each { |check| check.update(state: :completed, status: :info, latest_state: e, latest_updated_at: Time.now) }
end
end
def determinate_status_by_response(response)
return :critical if not regexp.blank? and response =~ /#{regexp}/