Sha256: 18d0d95ff815b1dc596a2f6d38ac8ed9e767e2ca76e6360a164304852d527ed3

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

# frozen_string_literal: true

module ProxES
  class FileSystemStatusCheck < StatusCheck
    def value
      children.values.min
    end

    def children
      @children ||= source_result['nodes']['nodes'].values.map do |node|
        next if node['attributes'] && node['attributes']['data'] == 'false'
        next if node['roles'] && node['roles'].include?('data') == false

        stats = node['fs']['total']
        [
          node['name'],
          stats['available_in_bytes'] / stats['total_in_bytes'].to_f * 100
        ]
      end.compact.to_h
    end

    def check
      return true if required_value.blank?

      value > required_value.to_f
    end

    def formatted(val = nil)
      format('%.4f%% Minimum Free', val || value)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
proxes-0.10.1 lib/proxes/models/status_checks/file_system_status_check.rb