okcomputer 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MmUyZWZjYmIwYmMxYzYwMzg5ODVmZTU4NzFjNzBjNTY4ZGRmMWQyYQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
M2ZmNjZmZTE2NTFjM2I1MTEwY2IxNTUxN2ExYzg2ZjY3OGI2MjE3Yg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTBjMDFiMmI3OGU1MjhmNDhhZWM2ODVmMjJkYmRhNzA4ZTE3MzNkZTliNDIy
|
10
|
+
Y2ZmYTY1OTYxZmEwZGNmYzI3MjA2OTZlMDI5NDAzMjU3NzUzYzg4NWY5NTY2
|
11
|
+
ZDhmMzk2OTA5MmVlOTBhN2RlZjM3YzQ1MmNiNWVhMzQ2NWMwNjU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MjNhMGVlM2M4ODYyOWY0ODczMmU3NDQ1OGYxN2MwNzdmOTA5NzAzNDQ1MjY0
|
14
|
+
Y2U1ZmJkMzRlMmQ0YzAzOTBhZDk3ZjRjNTU5MDg1NDhhYzU2NWVlODUxNmMz
|
15
|
+
NTNjZTMyYWU1YWFhMTZjZjQwMjQ5OWE5M2MxOGNmYWM0ZTdlNzQ=
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module OkComputer
|
2
2
|
# This class performs a health check on an elasticsearch cluster using the
|
3
3
|
# {cluster health API}[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-health.html].
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# It reports the cluster's name, number of nodes, and status (green, yellow,
|
6
6
|
# or red). A cluster status of red is reported as a failure, since this means
|
7
7
|
# one or more primary shards are unavailable. Note that the app may still
|
@@ -15,8 +15,7 @@ module OkComputer
|
|
15
15
|
# request_timeout - How long to wait to connect before timing out. Defaults to 5 seconds.
|
16
16
|
def initialize(host, request_timeout = 5)
|
17
17
|
@host = URI(host)
|
18
|
-
|
19
|
-
super(health_url, request_timeout)
|
18
|
+
super("#{host}/_cluster/health", request_timeout)
|
20
19
|
end
|
21
20
|
|
22
21
|
# Public: Return the status of the elasticsearch cluster
|
@@ -9,15 +9,14 @@ module OkComputer
|
|
9
9
|
class HttpCheck < Check
|
10
10
|
ConnectionFailed = Class.new(StandardError)
|
11
11
|
|
12
|
-
attr_accessor :url
|
13
|
-
attr_accessor :request_timeout
|
12
|
+
attr_accessor :url, :request_timeout, :basic_auth_username, :basic_auth_password
|
14
13
|
|
15
14
|
# Public: Initialize a new HTTP check.
|
16
15
|
#
|
17
16
|
# url - The URL to check
|
18
17
|
# request_timeout - How long to wait to connect before timing out. Defaults to 5 seconds.
|
19
18
|
def initialize(url, request_timeout = 5)
|
20
|
-
|
19
|
+
parse_url(url)
|
21
20
|
self.request_timeout = request_timeout.to_i
|
22
21
|
end
|
23
22
|
|
@@ -36,10 +35,25 @@ module OkComputer
|
|
36
35
|
# Otherwise raises a HttpCheck::ConnectionFailed error.
|
37
36
|
def perform_request
|
38
37
|
timeout(request_timeout) do
|
39
|
-
url.read(
|
38
|
+
url.read(
|
39
|
+
read_timeout: request_timeout,
|
40
|
+
http_basic_authentication: basic_auth_options
|
41
|
+
)
|
40
42
|
end
|
41
43
|
rescue => e
|
42
44
|
raise ConnectionFailed, e
|
43
45
|
end
|
46
|
+
|
47
|
+
def parse_url(url)
|
48
|
+
self.url = URI.parse(url)
|
49
|
+
if self.url.userinfo
|
50
|
+
self.basic_auth_username, self.basic_auth_password = self.url.userinfo.split(':')
|
51
|
+
self.url.userinfo = ''
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def basic_auth_options
|
56
|
+
[self.basic_auth_username, self.basic_auth_password]
|
57
|
+
end
|
44
58
|
end
|
45
59
|
end
|
@@ -10,8 +10,7 @@ module OkComputer
|
|
10
10
|
# request_timeout - How long to wait to connect before timing out. Defaults to 5 seconds.
|
11
11
|
def initialize(host, request_timeout = 5)
|
12
12
|
@host = URI(host)
|
13
|
-
|
14
|
-
super(ping_url, request_timeout)
|
13
|
+
super("#{host}/admin/ping", request_timeout)
|
15
14
|
end
|
16
15
|
|
17
16
|
# Public: Return the status of Solr
|
data/lib/ok_computer/version.rb
CHANGED
metadata
CHANGED
@@ -1,61 +1,61 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: okcomputer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Byrne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: coveralls
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: "\n Inspired by the simplicity of Fitter Happier, but frustrated
|
56
|
-
its lack of\n flexibility, we built OK Computer. Create and register your
|
57
|
-
custom\n health checks, or choose from the built-in library of checks to
|
58
|
-
your\n app is working as intended.\n "
|
55
|
+
description: ! "\n Inspired by the simplicity of Fitter Happier, but frustrated
|
56
|
+
by its lack of\n flexibility, we built OK Computer. Create and register your
|
57
|
+
own custom\n health checks, or choose from the built-in library of checks to
|
58
|
+
ensure your\n app is working as intended.\n "
|
59
59
|
email:
|
60
60
|
- patrick.byrne@tstmedia.com
|
61
61
|
executables: []
|
@@ -103,17 +103,17 @@ require_paths:
|
|
103
103
|
- lib
|
104
104
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
|
-
- -
|
106
|
+
- - ! '>='
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- -
|
111
|
+
- - ! '>='
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.
|
116
|
+
rubygems_version: 2.4.8
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: A simple, extensible health-check monitor
|