philae 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/philae/docker_probe.rb +2 -2
- data/lib/philae/http_probe.rb +3 -4
- data/lib/philae/mongo_probe.rb +4 -4
- data/lib/philae/philae_probe.rb +9 -3
- data/lib/philae/prober.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fb2abe798bfe65ac1f77da6a0284195eb73db03
|
4
|
+
data.tar.gz: 841db519d68f08b8de7187415b5d428391154780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c43748351457a9cdbe040a88fa8d557e47aae050fe73f3574e0ae56dafd22455d3ac940fc273239d328467bc9630714dba3fa5ae6963737cc5327cbcca08f21
|
7
|
+
data.tar.gz: 15527a9c4fa412943be8af12fdcaf96d8badf7d28c113798c987871954cfec84b8c7d1b323fe2b3077afc9a591f19cc41b996cf53c6e27ba37cecd71c4befc06
|
data/lib/philae/docker_probe.rb
CHANGED
data/lib/philae/http_probe.rb
CHANGED
@@ -19,12 +19,11 @@ module Philae
|
|
19
19
|
resp = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
20
20
|
http.request(req)
|
21
21
|
end
|
22
|
-
|
23
|
-
return false if resp.code.to_s[0] != '2' && resp.code.to_s[0] != '3'
|
22
|
+
return { healthy: false, comment: 'Invalid response code' } if resp.code.to_s[0] != '2' && resp.code.to_s[0] != '3'
|
24
23
|
rescue
|
25
|
-
return false
|
24
|
+
return { healthy: false, comment: 'Unable to contact server' }
|
26
25
|
end
|
27
|
-
true
|
26
|
+
{ healthy: true, comment: '' }
|
28
27
|
end
|
29
28
|
end
|
30
29
|
end
|
data/lib/philae/mongo_probe.rb
CHANGED
@@ -11,13 +11,13 @@ module Philae
|
|
11
11
|
|
12
12
|
def check
|
13
13
|
begin
|
14
|
-
client = Mongo::Client.new(@uri)
|
15
|
-
db = client.
|
14
|
+
client = Mongo::Client.new(@uri, max_read_retries: 1)
|
15
|
+
db = client.database
|
16
16
|
db.collection_names
|
17
17
|
rescue
|
18
|
-
return false
|
18
|
+
return { healthy: false, comment: 'Unable to conctact mongo' }
|
19
19
|
end
|
20
|
-
true
|
20
|
+
{ healthy: true, comment: '' }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/philae/philae_probe.rb
CHANGED
@@ -21,12 +21,18 @@ module Philae
|
|
21
21
|
http.request(req)
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
if resp.code.to_s[0] != '2' && resp.code.to_s[0] != '3'
|
25
|
+
return { healthy: false, comment: 'Invalid return code' }
|
26
|
+
end
|
25
27
|
|
26
28
|
status = JSON.parse(resp.body)
|
27
|
-
|
29
|
+
if status['healthy']
|
30
|
+
return { healthy: true, comment: '' }
|
31
|
+
else
|
32
|
+
return { healthy: false, comment: 'node not healthy' }
|
33
|
+
end
|
28
34
|
rescue
|
29
|
-
return false
|
35
|
+
return { healthy: false, comment: 'Unable to contact server' }
|
30
36
|
end
|
31
37
|
end
|
32
38
|
end
|
data/lib/philae/prober.rb
CHANGED
@@ -10,7 +10,8 @@ module Philae
|
|
10
10
|
|
11
11
|
def check
|
12
12
|
probes_status = @probes.map do |probe|
|
13
|
-
|
13
|
+
status = probe.check
|
14
|
+
{ name: probe.name, healthy: status[:healthy], comment: status[:comment] }
|
14
15
|
end
|
15
16
|
|
16
17
|
global = probes_status.all? do |probe|
|