Sha256: 3bb527552ef9133dd10c06e40c518a84caaa8215380706cb10b6f35bc0b23caf

Contents?: true

Size: 587 Bytes

Versions: 26

Compression:

Stored size: 587 Bytes

Contents

module Marty::Diagnostic::Node
  def self.my_ip
    begin
      Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address
    rescue => e
      e.message
    end
  end



  def self.get_target_connections target
    Marty::Diagnostic::Database.current_connections.select{|conn|
      conn['application_name'].include?(target)
    }.map{|conn|
      conn['client_addr'] == '127.0.0.1' ? my_ip :
        conn['client_addr'] || '127.0.0.1'
    }
  end

  def self.get_nodes
    nodes = get_target_connections('Passenger').uniq.compact
    nodes.empty? ? [my_ip] : nodes
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
marty-2.5.2 other/marty/diagnostic/node.rb
marty-2.5.1 other/marty/diagnostic/node.rb
marty-2.5.0 other/marty/diagnostic/node.rb
marty-2.4.9 other/marty/diagnostic/node.rb
marty-2.4.8 other/marty/diagnostic/node.rb
marty-2.4.7 other/marty/diagnostic/node.rb
marty-2.4.6 other/marty/diagnostic/node.rb
marty-2.4.5 other/marty/diagnostic/node.rb
marty-2.4.4 other/marty/diagnostic/node.rb
marty-2.4.3 other/marty/diagnostic/node.rb
marty-2.4.2 other/marty/diagnostic/node.rb
marty-2.4.1 other/marty/diagnostic/node.rb
marty-2.4.0 other/marty/diagnostic/node.rb
marty-2.3.15 other/marty/diagnostic/node.rb
marty-2.3.14 other/marty/diagnostic/node.rb
marty-2.3.13 other/marty/diagnostic/node.rb
marty-2.3.12 other/marty/diagnostic/node.rb
marty-2.3.11 other/marty/diagnostic/node.rb
marty-2.3.10 other/marty/diagnostic/node.rb
marty-2.3.9 other/marty/diagnostic/node.rb