Class: Heartcheck::Services::Firewall
- Inherits:
-
Object
- Object
- Heartcheck::Services::Firewall
- Defined in:
- lib/heartcheck/services/firewall.rb
Overview
A service to check with a simple telnet if the route to a host is working.
Instance Attribute Summary collapse
-
#proxy ⇒ Object
readonly
Returns the value of attribute proxy.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#host ⇒ String
to get the host or stract from @uri.
-
#initialize(params) ⇒ void
constructor
Sets up the options to firewall.
-
#params ⇒ Hash
format params to use in Telnet.
-
#port ⇒ Integre
to get the port or stract from @uri.
Constructor Details
#initialize(params) ⇒ void
Sets up the options to firewall.
26 27 28 29 30 31 32 |
# File 'lib/heartcheck/services/firewall.rb', line 26 def initialize(params) @host = params[:host] @port = params[:port] @proxy = params[:proxy] @timeout = params[:timeout] || 2 @uri = URI(params[:url].to_s) end |
Instance Attribute Details
#proxy ⇒ Object (readonly)
Returns the value of attribute proxy.
8 9 10 |
# File 'lib/heartcheck/services/firewall.rb', line 8 def proxy @proxy end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
8 9 10 |
# File 'lib/heartcheck/services/firewall.rb', line 8 def uri @uri end |
Instance Method Details
#host ⇒ String
to get the host or stract from @uri
50 51 52 |
# File 'lib/heartcheck/services/firewall.rb', line 50 def host @host || uri.host end |
#params ⇒ Hash
format params to use in Telnet
41 42 43 44 45 |
# File 'lib/heartcheck/services/firewall.rb', line 41 def params params = { 'Host' => host, 'Port' => port, 'Timeout' => @timeout } params['Proxy'] = proxy_uri if proxy params end |
#port ⇒ Integre
to get the port or stract from @uri
57 58 59 |
# File 'lib/heartcheck/services/firewall.rb', line 57 def port @port || uri.port end |