Sha256: 7d8f2b2ab790322fb27368b9a0e71e74535f480ae4cc7048645554860950140e

Contents?: true

Size: 606 Bytes

Versions: 1

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class LoadAverages < BaseResolver
      init_resolver

      class << self
        private

        def post_resolve(fact_name)
          @fact_list.fetch(fact_name) { read_load_averages(fact_name) }
        end

        def read_load_averages(fact_name)
          require_relative 'utils/ffi/load_averages'

          log.debug('loading cpu load averages')
          @fact_list[:load_averages] = %w[1m 5m 15m].zip(Utils::Ffi::LoadAverages.read_load_averages).to_h

          @fact_list[fact_name]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facter-4.0.46 lib/facter/resolvers/load_averages.rb