class F5::Cli::Node

Public Instance Methods

disable(node) click to toggle source
# File lib/f5/cli/application.rb, line 83
def disable(node)
  client.LocalLB.NodeAddressV2.set_monitor_state(
    nodes: { item: [ node ] },
    states: { item: [ "STATE_DISABLED" ] }
  )
end
enable(node) click to toggle source
# File lib/f5/cli/application.rb, line 91
def enable(node)
  client.LocalLB.NodeAddressV2.set_monitor_state(
    nodes: { item: [ node ] },
    states: { item: [ "STATE_ENABLED" ] }
  )
end
list() click to toggle source
# File lib/f5/cli/application.rb, line 56
def list
  response = client.LocalLB.NodeAddressV2.get_list

  nodes = extract_items(response, :as_array)
  if nodes.empty?
    puts "No nodes found"
  else
    nodes.each do |node|
      puts node
    end
  end
end
show(node) click to toggle source
# File lib/f5/cli/application.rb, line 70
def show(node)
  session_status = extract_items client.LocalLB.NodeAddressV2.get_object_status(nodes: { item: [ node ] })
  stats = client.LocalLB.NodeAddressV2.get_statistics(nodes: { item: [ node ] })
  outer_envelope = extract_items stats[:statistics]
  stats = extract_items outer_envelope[:statistics]

  total_connections = stats.find { |stat| stat[:type] == "STATISTIC_SERVER_SIDE_CURRENT_CONNECTIONS" }
  total_connections = total_connections[:value][:low]

  puts "#{node} #{session_status[:availability_status]} (#{session_status[:status_description]}) with #{total_connections} connections"
end