Module: Hcheck::Checks::Rabbitmq

Defined in:
lib/hcheck/checks/rabbitmq.rb

Overview

rabbitmq check module implements status include rabbitmq check dependencies

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(_base) ⇒ Object



24
25
26
# File 'lib/hcheck/checks/rabbitmq.rb', line 24

def self.included(_base)
  require 'bunny'
end

Instance Method Details

#status(config) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/hcheck/checks/rabbitmq.rb', line 8

def status(config)
  connection = Bunny.new(config)
  connection.start
  connection.close
  'ok'
rescue Bunny::TCPConnectionFailed,
       Bunny::TCPConnectionFailedForAllHosts,
       Bunny::NetworkFailure,
       Bunny::AuthenticationFailureError,
       Bunny::PossibleAuthenticationFailureError,
       AMQ::Protocol::EmptyResponseError => e

  Hcheck.logger.error "[HCheck] Bunny::Error #{e.message}"
  'bad'
end