server_health_check 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/server_health_check/version.rb +1 -1
- data/lib/server_health_check.rb +11 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1980c0a16cbdaca5e280995a96ee9d5f185b4389
|
4
|
+
data.tar.gz: 4f06712ed902413536a8207ecc106feab43b261f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b26ab14fc7a1cbd14d91da86f6ad6b91892024604f0aae73247b3a8e1bc6f57711c29660dd2b4d320a2d1cc49887b12a3857cc780f143e8fa8662f7b41a46d17
|
7
|
+
data.tar.gz: 6393cb1717860463f731797b28886e1129a377b0948612ed23f9f43d3d4406e668875266a6089166c6491abb06a36bbbfba0c46537fe0b9f7dfa2627d0b2359c
|
data/lib/server_health_check.rb
CHANGED
@@ -2,8 +2,10 @@ require "server_health_check/version"
|
|
2
2
|
|
3
3
|
class ServerHealthCheck
|
4
4
|
OK = 'OK'.freeze
|
5
|
+
attr_reader :logger
|
5
6
|
|
6
|
-
def initialize
|
7
|
+
def initialize(options = {})
|
8
|
+
@logger = options[:logger]
|
7
9
|
@results = {}
|
8
10
|
end
|
9
11
|
|
@@ -32,7 +34,9 @@ class ServerHealthCheck
|
|
32
34
|
end
|
33
35
|
|
34
36
|
def aws_s3!(bucket = nil)
|
35
|
-
|
37
|
+
options = {}
|
38
|
+
options[:logger] = logger if logger
|
39
|
+
bucket = Aws::S3::Bucket.new(bucket, options)
|
36
40
|
if bucket.exists?
|
37
41
|
@results[:S3] = OK
|
38
42
|
true
|
@@ -43,7 +47,9 @@ class ServerHealthCheck
|
|
43
47
|
end
|
44
48
|
|
45
49
|
def aws_creds!
|
46
|
-
|
50
|
+
options = {}
|
51
|
+
options[:logger] = logger if logger
|
52
|
+
aws = Aws::S3::Client.new(options)
|
47
53
|
begin
|
48
54
|
aws.list_buckets
|
49
55
|
@results[:AWS] = OK
|
@@ -63,8 +69,8 @@ class ServerHealthCheck
|
|
63
69
|
@results[name.to_sym] = "Failed"
|
64
70
|
false
|
65
71
|
end
|
66
|
-
|
67
|
-
|
72
|
+
rescue => e
|
73
|
+
@results[name.to_sym] = e.to_s
|
68
74
|
end
|
69
75
|
|
70
76
|
def ok?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: server_health_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Quenten Griffith
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.4.
|
95
|
+
rubygems_version: 2.4.8
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Healthcheck for web apps.
|