Sha256: 52ab6ed95d02c16365da6515685d6c35893cf308dbdd608d2d73755d5ba6ab81
Contents?: true
Size: 744 Bytes
Versions: 6
Compression:
Stored size: 744 Bytes
Contents
# frozen_string_literal: true module Facter module Resolvers module Linux class LoadAverages < BaseResolver @log = Facter::Log.new(self) @semaphore = Mutex.new @fact_list ||= {} class << self private def post_resolve(fact_name) @fact_list.fetch(fact_name) { read_load_averages_file(fact_name) } end def read_load_averages_file(fact_name) return unless File.readable?('/proc/loadavg') output = File.read('/proc/loadavg') @fact_list[:load_averages] = {}.tap { |h| h['1m'], h['5m'], h['15m'], = output.split.map(&:to_f) } @fact_list[fact_name] end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems