Class: Naminori::Service::Http
- Inherits:
-
Base
- Object
- Base
- Naminori::Service::Http
show all
- Defined in:
- lib/naminori/service/http.rb
Instance Attribute Summary
Attributes inherited from Base
#config
Instance Method Summary
collapse
Methods inherited from Base
event, event_ip, #initialize
Instance Method Details
#default_config ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/naminori/service/http.rb', line 17
def default_config
{
role: "http",
port: "80",
protocols: ["tcp"],
vip: "192.168.77.9",
method: "nat",
query: "index.html",
retry: 3,
timeout: 3,
notifier: nil
}
end
|
#healty?(ip) ⇒ Boolean
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/naminori/service/http.rb', line 6
def healty?(ip)
http = Net::HTTP.new(ip, config.port)
http.open_timeout = config.timeout
begin
http.get("/#{@query}")
rescue => e
false
end
end
|