Sha256: 3722b9cdabefbc76e19a01f58b9a809bcef8d13e565f5b5f15c257ad7be1f420

Contents?: true

Size: 543 Bytes

Versions: 2

Compression:

Stored size: 543 Bytes

Contents

module Heartcheck
  module Checks
    class Firewall < Base
      def services
        super.map { |opts| Services::Firewall.new(opts) }
      end

      def validate
        services.each do |service|
          begin
            Net::Telnet.new(service.params)
          rescue Errno::ECONNREFUSED; nil
          rescue
            append_error(service)
          end
        end
      end

      private

      def custom_error(service)
        @errors << "connection refused on: #{service.host}:#{service.port}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
heartcheck-1.0.3 lib/heartcheck/checks/firewall.rb
heartcheck-1.0.0 lib/heartcheck/checks/firewall.rb