Sha256: cfa3149a9e8d078f5dc84f5d3f564de05cd44726eb970e512e4ae6509d2abba3

Contents?: true

Size: 738 Bytes

Versions: 13

Compression:

Stored size: 738 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)
        error_message = "connection refused on: #{service.host}:#{service.port}"

        if service.proxy
          proxy_uri = URI(service.proxy)
          error_message << " via proxy: #{proxy_uri.host}:#{proxy_uri.port}"
        end

        @errors << error_message
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
heartcheck-1.4.0 lib/heartcheck/checks/firewall.rb
heartcheck-1.3.0 lib/heartcheck/checks/firewall.rb
heartcheck-1.2.2 lib/heartcheck/checks/firewall.rb
heartcheck-1.2.1 lib/heartcheck/checks/firewall.rb
heartcheck-1.2.0 lib/heartcheck/checks/firewall.rb
heartcheck-1.1.1 lib/heartcheck/checks/firewall.rb
heartcheck-1.1.0 lib/heartcheck/checks/firewall.rb
heartcheck-1.0.9 lib/heartcheck/checks/firewall.rb
heartcheck-1.0.8 lib/heartcheck/checks/firewall.rb
heartcheck-1.0.7 lib/heartcheck/checks/firewall.rb
heartcheck-1.0.6 lib/heartcheck/checks/firewall.rb
heartcheck-1.0.5 lib/heartcheck/checks/firewall.rb
heartcheck-1.0.4 lib/heartcheck/checks/firewall.rb