class OkComputer::RabbitmqCheck

Constants

ConnectionFailed

Attributes

url[R]

Public Class Methods

new(url = nil) click to toggle source
# File lib/ok_computer/built_in_checks/rabbitmq_check.rb, line 5
def initialize(url = nil)
  @url = url || ENV['CLOUDAMQP_URL'] || ENV['AMQP_HOST']
end

Public Instance Methods

check() click to toggle source
# File lib/ok_computer/built_in_checks/rabbitmq_check.rb, line 9
def check
  mark_message "Connected Successfully"
  mark_message "Rabbit Connection Status: (#{connection_status})"
rescue => e
  mark_failure
  mark_message "Error: '#{e}'"
end
connection_status() click to toggle source
# File lib/ok_computer/built_in_checks/rabbitmq_check.rb, line 17
def connection_status
  connection = Bunny.new(@url)
  connection.start
  status = connection.status
  connection.close
  status
rescue => e
  raise ConnectionFailed, e
end