app/models/my_nagios/check.rb in my_nagios-0.0.4 vs app/models/my_nagios/check.rb in my_nagios-0.0.5

- old
+ new

@@ -9,16 +9,16 @@ def run! begin self.update(state: :running) - Net::SSH.start( self.host, self.user, config: true, keys: [self.pem_key] ) do| ssh | + Net::SSH.start( self.host, self.user, config: true, keys: [self.pem_key], non_interactive: true ) do| ssh | result = ssh.exec! self.command self.update(status: Check.determinate_status_by_response(result), latest_state: result, latest_updated_at: Time.now) end rescue => e - self.update(status: :critical, latest_state: e, latest_updated_at: Time.now) + self.update(status: :info, latest_state: e, latest_updated_at: Time.now) ensure self.update(state: :completed) end end @@ -26,18 +26,18 @@ check_list = MyNagios::Check.where(id: check_ids) begin check_list.update_all(state: :running) - Net::SSH.start( config['host'], config['user'], config: true, keys: [config['pem_key']] ) do |ssh| + Net::SSH.start( config['host'], config['user'], config: true, keys: [config['pem_key']], non_interactive: true ) do |ssh| check_list.each do |check| result = ssh.exec! check.command check.update(status: Check.determinate_status_by_response(result), latest_state: result, latest_updated_at: Time.now) end end rescue => e - check_list.update_all(status: :critical, latest_state: e, latest_updated_at: Time.now) + check_list.update_all(status: :info, latest_state: e, latest_updated_at: Time.now) ensure check_list.update_all(state: :completed) end end