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

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

Constant Summary collapse

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

#initialize(group) ⇒ Process

Returns 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

#commandObject

Returns the value of attribute command.



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

def command
  @command
end

#connect_passwordObject

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

#cpuObject

Returns the value of attribute cpu.



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

def cpu
  @cpu
end

#groupObject (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

#gupidObject

Returns the value of attribute gupid.



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

def gupid
  @gupid
end

#has_metricsObject

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

#pidObject

Returns the value of attribute pid.



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

def pid
  @pid
end

#process_group_idObject

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

#processedObject

Returns the value of attribute processed.



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

def processed
  @processed
end

#real_memoryObject

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

#rssObject

Returns the value of attribute rss.



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

def rss
  @rss
end

#server_socketsObject

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

#sessionsObject

Returns the value of attribute sessions.



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

def sessions
  @sessions
end

#uptimeObject

Returns the value of attribute uptime.



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

def uptime
  @uptime
end

#vmsizeObject

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

#connect(socket_name = :main) ⇒ Object



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

#has_metrics?Boolean

Returns:

  • (Boolean)


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

def has_metrics?
	return @has_metrics
end