Sha256: df5dd1389ac90597d1a05ccfa2a86244f88188269f45149144518358de29e350

Contents?: true

Size: 433 Bytes

Versions: 8

Compression:

Stored size: 433 Bytes

Contents

module Easymon
  class ActiveRecordCheck
    attr_accessor :klass
    
    def initialize(klass)
      self.klass = klass
    end 
    
    def check
      check_status = database_up?
      if check_status
        message = "Up"
      else
        message = "Down"
      end
      [check_status, message]
    end
    
    private
      def database_up?
        klass.connection.active?
      rescue
        false
      end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
easymon-1.6.2 lib/easymon/checks/active_record_check.rb
easymon-1.6.1 lib/easymon/checks/active_record_check.rb
easymon-1.5 lib/easymon/checks/active_record_check.rb
easymon-1.6.0 lib/easymon/checks/active_record_check.rb
easymon-1.4.2 lib/easymon/checks/active_record_check.rb
easymon-1.4.1 lib/easymon/checks/active_record_check.rb
easymon-1.4 lib/easymon/checks/active_record_check.rb
easymon-1.3 lib/easymon/checks/active_record_check.rb