Class: Halb::LoadBalancer
Instance Method Summary
collapse
#get_output_of, #initialize, #open_connection, #perform, #put_in_maintenance, #remove_from_maintenance
Instance Method Details
#active? ⇒ Boolean
7
8
9
|
# File 'lib/halb/load_balancer.rb', line 7
def active?
!/TCP[ ]+\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}/.match(get_output_of(show_active_hosts_command)).nil?
end
|
#in_maintenance_command(service_endpoint) ⇒ Object
11
12
13
|
# File 'lib/halb/load_balancer.rb', line 11
def in_maintenance_command(service_endpoint)
"touch /etc/ha.d/maintenance/#{service_endpoint}"
end
|
#out_of_maintenance_command(service_endpoint) ⇒ Object
15
16
17
|
# File 'lib/halb/load_balancer.rb', line 15
def out_of_maintenance_command(service_endpoint)
"rm /etc/ha.d/maintenance/#{service_endpoint}"
end
|
#service_endpoint_for(ip_address) ⇒ Object
19
20
21
|
# File 'lib/halb/load_balancer.rb', line 19
def service_endpoint_for(ip_address)
"#{ip_address}:80"
end
|
#show_active_hosts_command ⇒ Object
3
4
5
|
# File 'lib/halb/load_balancer.rb', line 3
def show_active_hosts_command
'ipvsadm -l -n'
end
|