Sha256: e7a18d48f030554073f3e5ae3b160c758f04c4896bd94c16cf5663508d53fc4e

Contents?: true

Size: 475 Bytes

Versions: 62

Compression:

Stored size: 475 Bytes

Contents

module Workarea
  module Monitoring
    class ElasticsearchCheck

      def check
        status = Workarea.elasticsearch.cluster.health.try(:[], 'status')

        if status_ok?(status)
          [true, 'Up']
        else
          [false, 'Down']
        end
      end

      private

      def status_ok?(status)
        status &&
          (Rails.env.production?  && status == 'green') ||
          (!Rails.env.production? && status != 'red')
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.4.27 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.5.4 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.26 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.5.3 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.25 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.5.2 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.24 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.5.1 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.23 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.22 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.5.0 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.21 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.5.0.beta.1 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.20 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.19 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.18 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.17 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.16 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.15 lib/workarea/monitoring/elasticsearch_check.rb
workarea-core-3.4.14 lib/workarea/monitoring/elasticsearch_check.rb