Method: ElbPing::Display.response

Defined in:
lib/elbping/display.rb

.response(status) ⇒ Object

Format and display the ping data given a response

Arguments:

  • status: (hash) containing:

    • :node (string) IP address of node

    • :code (Fixnum || string || symbol) HTTP status code or symbol representing error during ping

    • :duration (Fixnum) Latency in milliseconds from ping

    • :exception (string, optional) Message to display from exception



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/elbping/display.rb', line 45

def self.response(status)
  node = status[:node]
  code = status[:code]
  duration = status[:duration]
  exc = status[:exception]
  sslSubject = status[:sslSubject].join(',') if status[:sslSubject]
  sslExpires = status[:sslExpires]
  sslHostMatch = status[:sslHostMatch]

  exc_display = exc ? "exception=#{exc}" : ''
  ssl_display = (sslSubject and sslExpires) ? "ssl cn=#{sslSubject} match=#{sslHostMatch} expires=#{sslExpires}" : ''

  self.out "Response from: #{node.rjust(15)}: code=#{code.to_s} time=#{duration}ms #{ssl_display} #{exc_display}"
end