Class: PhusionPassenger::AdminTools::ServerInstance::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/phusion_passenger/admin_tools/server_instance.rb

Constant Summary

INT_PROPERTIES =
[:pid, :sessions, :processed, :cpu, :rss, :real_memory,
:vmsize, :process_group_id]
BOOL_PROPERTIES =
[:has_metrics]

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Process) initialize(group)

A new instance of Process



82
83
84
85
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 82

def initialize(group)
	@group = group
	@server_sockets = {}
end

Instance Attribute Details

- (Object) command

Returns the value of attribute command



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def command
  @command
end

- (Object) connect_password

Returns the value of attribute connect_password



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def connect_password
  @connect_password
end

- (Object) cpu

Returns the value of attribute cpu



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def cpu
  @cpu
end

- (Object) group (readonly)

Returns the value of attribute group



74
75
76
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 74

def group
  @group
end

- (Object) gupid

Returns the value of attribute gupid



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def gupid
  @gupid
end

- (Object) has_metrics

Returns the value of attribute has_metrics



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def has_metrics
  @has_metrics
end

- (Object) pid

Returns the value of attribute pid



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def pid
  @pid
end

- (Object) process_group_id

Returns the value of attribute process_group_id



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def process_group_id
  @process_group_id
end

- (Object) processed

Returns the value of attribute processed



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def processed
  @processed
end

- (Object) real_memory

Returns the value of attribute real_memory



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def real_memory
  @real_memory
end

- (Object) rss

Returns the value of attribute rss



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def rss
  @rss
end

- (Object) server_sockets

Returns the value of attribute server_sockets



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def server_sockets
  @server_sockets
end

- (Object) sessions

Returns the value of attribute sessions



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def sessions
  @sessions
end

- (Object) uptime

Returns the value of attribute uptime



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def uptime
  @uptime
end

- (Object) vmsize

Returns the value of attribute vmsize



75
76
77
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 75

def vmsize
  @vmsize
end

Instance Method Details

- (Object) connect(socket_name = :main)



87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 87

def connect(socket_name = :main)
	socket_info = @server_sockets[socket_name]
	if !socket_info
		raise "This process has no server socket named '#{socket_name}'."
	end
	if socket_info.address_type == 'unix'
		return UNIXSocket.new(socket_info.address)
	else
		host, port = socket_info.address.split(':', 2)
		return TCPSocket.new(host, port.to_i)
	end
end

- (Boolean) has_metrics?

Returns:

  • (Boolean)


100
101
102
# File 'lib/phusion_passenger/admin_tools/server_instance.rb', line 100

def has_metrics?
	return @has_metrics
end