Module: Eye::Controller::Status

Included in:
Eye::Controller
Defined in:
lib/eye/controller/status.rb

Instance Method Summary collapse

Instance Method Details

#info_data(mask = nil) ⇒ Object



10
11
12
# File 'lib/eye/controller/status.rb', line 10

def info_data(mask = nil)
  {:subtree => info_objects(mask).map{|a| a.status_data } }
end

#info_data_debug(mask = nil) ⇒ Object



14
15
16
# File 'lib/eye/controller/status.rb', line 14

def info_data_debug(mask = nil)
  {:subtree => info_objects(mask).map{|a| a.status_data(true) } }
end

#info_objects(mask = nil) ⇒ Object



3
4
5
6
7
8
# File 'lib/eye/controller/status.rb', line 3

def info_objects(mask = nil)
  res = []
  return @applications unless mask
  matched_objects(mask){|obj| res << obj }    
  res
end

#info_string(mask = nil) ⇒ Object



18
19
20
# File 'lib/eye/controller/status.rb', line 18

def info_string(mask = nil)
  make_str(info_data(mask)).to_s
end

#info_string_debug(show_config = false, show_processes = false) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/eye/controller/status.rb', line 26

def info_string_debug(show_config = false, show_processes = false)
  actors = Celluloid::Actor.all.map{|actor| actor.instance_variable_get(:@klass) }.group_by{|a| a}.map{|k,v| [k, v.size]}.sort_by{|a|a[1]}.reverse

  str = <<-S
About:  #{Eye::ABOUT}
Info:   #{resources_str(Eye::SystemResources.resources($$), false)}
Logger: #{Eye::Logger.dev}
Socket: #{Eye::Settings::socket_path}
PidPath: #{Eye::Settings::pid_path}
Actors: #{actors.inspect}

  S

  str += make_str(info_data_debug) + "\n" if show_processes.present?

  if show_config.present?
    str += "\nCurrent config: \n"
    str += YAML.dump(current_config)
  end

  GC.start
  str
end

#info_string_shortObject



22
23
24
# File 'lib/eye/controller/status.rb', line 22

def info_string_short
  make_str({:subtree => @applications.map{|a| a.status_data_short } }).to_s
end