Class: DogNotGod::Commands::LoadStats

Inherits:
ClientCommand show all
Defined in:
lib/client_commands.rb

Overview

Load average statistics

Instance Method Summary collapse

Methods inherited from ClientCommand

#get_hostname_from_shell, #run!

Instance Method Details

#_executeObject



58
59
60
# File 'lib/client_commands.rb', line 58

def _execute
  @resource["/load_stats"].post({:load_5_min => @load_averages[0], :load_10_min => @load_averages[1], :load_15_min => @load_averages[2], :hostname => @hostname})
end

#_prepareObject



53
54
55
56
# File 'lib/client_commands.rb', line 53

def _prepare
  @hostname = get_hostname_from_shell
  @load_averages = get_load_averages_from_shell
end

#get_load_averages_from_shellObject



62
63
64
# File 'lib/client_commands.rb', line 62

def get_load_averages_from_shell
  DogNotGod::Shell.call("uptime").scan(/(\d+\.\d\d)/)
end