Class: F5::Cli::Node
- Inherits:
-
Subcommand
- Object
- Thor
- Subcommand
- F5::Cli::Node
- Defined in:
- lib/f5/cli/application.rb
Instance Method Summary collapse
Instance Method Details
#disable(node) ⇒ Object
83 84 85 86 87 88 |
# 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) ⇒ Object
91 92 93 94 95 96 |
# 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 ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# 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) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 |
# 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 |