Sha256: 421bc451408560784ca69495362d8a4c9c67189356b264250860dcb80c862cb7

Contents?: true

Size: 780 Bytes

Versions: 1

Compression:

Stored size: 780 Bytes

Contents

module Hcheck
  module Checks
    # rabbitmq check module
    # implements status
    # include rabbitmq check dependencies
    module Rabbitmq
      # @config { host, vhost, port, user, pass }
      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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hcheck-0.1.0 lib/hcheck/checks/rabbitmq.rb