Sha256: 6ee4ff64e8e9c397a238d5c195df512d4cf41821b5746c7d4754ac5cf0c5c08a

Contents?: true

Size: 788 Bytes

Versions: 4

Compression:

Stored size: 788 Bytes

Contents

module I2X
  class Checkup

    ##
    # = Perform the actual check execution
    #
    # + *agent*: the agent to verify
    #
    def execute agent
      begin
        @response = agent.execute
      rescue Exception => e
       
        @response = {:status => 400, :error => e}
      end       
    end
    

    ##
    # = Initiate real-time (poll) check
    #
    # + *schedule*: the scheduling being checked
    def check schedule
      Integration.all.each do |integration|
        @agents = integration.agents.where( :schedule => schedule).where("last_check_at < CURRENT_TIMESTAMP - INTERVAL 5 MINUTE")
        @agents.each do |agent|
          begin
            self.execute agent
          rescue Exception => e
           
          end
        end
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
i2x-0.0.6 lib/i2x/checkup.rb
i2x-0.0.5 lib/i2x/checkup.rb
i2x-0.0.4 lib/i2x/checkup.rb
i2x-0.0.3 lib/i2x/checkup.rb