Class: LogStash::Instrument::PeriodicPoller::LoadAverage::Linux

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/instrument/periodic_poller/load_average.rb

Constant Summary collapse

LOAD_AVG_FILE =
"/proc/loadavg"
TOKEN_SEPARATOR =
" "

Class Method Summary collapse

Class Method Details

.getObject



14
15
16
17
18
19
20
21
22
# File 'lib/logstash/instrument/periodic_poller/load_average.rb', line 14

def self.get
  load_average = ::File.read(LOAD_AVG_FILE).chomp.split(TOKEN_SEPARATOR)

  {
    :"1m" => load_average[0].to_f,
    :"5m" => load_average[1].to_f,
    :"15m" => load_average[2].to_f
  }
end