heartcheck 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +4 -0
- data/README.md +27 -0
- data/lib/heartcheck/app.rb +1 -0
- data/lib/heartcheck/checks/base.rb +7 -0
- data/lib/heartcheck/checks/firewall.rb +10 -0
- data/lib/heartcheck/controllers/inspect.rb +25 -0
- data/lib/heartcheck/services/firewall.rb +3 -3
- data/lib/heartcheck/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6dfd09304fc0ad36774293f2e0e04a3d3ea542acf6ac86bb4415fb558815f109
|
4
|
+
data.tar.gz: d6ef9bcee013849cf771c2e14c3699bc53bd664fc5be70a091dc63c5d54c63fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63907f0c4b890db4b3466160bb2fe2707058f3fd3f25ef3e33380fca89f04fa9c0a16d74f929fadc686641b2ce43016021272f9436e40635aed83369d3ad56ca
|
7
|
+
data.tar.gz: f56971cdc1ad9d83dc1a0dbc62ca3da7de40bb536f0fd79116346c5055b5c1dc8491fc6857046ab83fce439131c154ba6941084ddcd88e378ecdb0ca26fdcef1
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -37,6 +37,26 @@ Then edit the generated file by adding your checks on it and restart your
|
|
37
37
|
server. Now you should be able to make a HTTP request for `/monitoring` and
|
38
38
|
get a JSON response that contains the status for each monitored service.
|
39
39
|
|
40
|
+
The following environment variables are needed by heartcheck:
|
41
|
+
|
42
|
+
HEARTCHECK_APP_NAME=MyApplicationName
|
43
|
+
|
44
|
+
|
45
|
+
### Using built-in checks
|
46
|
+
|
47
|
+
#### Firewall check
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
Heartcheck.setup do |config|
|
51
|
+
config.add :firewall do |c|
|
52
|
+
c.add_service(host: 'domain.com', port: 80)
|
53
|
+
c.add_service(host: 'domain.com', port: 80, timeout: 5) # Default timeout is 2 seconds
|
54
|
+
c.add_service(url: 'https://domain.com')
|
55
|
+
c.add_service(url: 'https://domain.com', proxy: 'http://proxy.domain.com')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
40
60
|
## HTTP Routes
|
41
61
|
|
42
62
|
#### Basic health check
|
@@ -74,6 +94,13 @@ checks:
|
|
74
94
|
|
75
95
|
/monitoring/health_check
|
76
96
|
|
97
|
+
|
98
|
+
#### General info and dependencies
|
99
|
+
|
100
|
+
Returns general application info and a list of dependencies' URIs, but executes no checking:
|
101
|
+
|
102
|
+
/monitoring/inspect
|
103
|
+
|
77
104
|
## Plugins
|
78
105
|
|
79
106
|
* [ActiveRecord](https://github.com/locaweb/heartcheck-activerecord)
|
data/lib/heartcheck/app.rb
CHANGED
@@ -16,6 +16,7 @@ module Heartcheck
|
|
16
16
|
'/functional' => Controllers::Functional,
|
17
17
|
'/dev' => Controllers::Dev,
|
18
18
|
'/info' => Controllers::Info,
|
19
|
+
'/inspect' => Controllers::Inspect,
|
19
20
|
'/health_check' => Controllers::HealthCheck,
|
20
21
|
'/environment' => Controllers::Environment
|
21
22
|
}
|
@@ -133,6 +133,13 @@ module Heartcheck
|
|
133
133
|
"#<#{self.class.name} name: #{name}, functional: #{functional?}, dev: #{dev?}>"
|
134
134
|
end
|
135
135
|
|
136
|
+
# Returns a structure comprised of host, port and
|
137
|
+
# schema (protocol) for the check
|
138
|
+
#
|
139
|
+
# @return [Hash]
|
140
|
+
def uri_info
|
141
|
+
{ error: "#{self.class.name} #url_info not implemented." }
|
142
|
+
end
|
136
143
|
|
137
144
|
def informations
|
138
145
|
info
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Heartcheck
|
2
|
+
module Controllers
|
3
|
+
class Inspect < Base
|
4
|
+
def index
|
5
|
+
results = {
|
6
|
+
application_name: application_name,
|
7
|
+
dependencies: []
|
8
|
+
}
|
9
|
+
|
10
|
+
checks = Heartcheck.checks
|
11
|
+
results[:dependencies] += checks.reduce([]) do |acc, elem|
|
12
|
+
acc << elem.uri_info
|
13
|
+
end.flatten.uniq
|
14
|
+
|
15
|
+
MultiJson.dump(results)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def application_name
|
21
|
+
ENV.fetch('HEARTCHECK_APP_NAME')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -14,13 +14,13 @@ module Heartcheck
|
|
14
14
|
# @option params [Integer] :port Number of port to check
|
15
15
|
# @option params [String] :proxy The uri of your proxy if is required
|
16
16
|
# @option params [integer] :timeout (defaults to: 2) Number in seconds
|
17
|
-
# @option params [string] :
|
17
|
+
# @option params [string] :url You can pass a URI instead a host and port
|
18
18
|
#
|
19
19
|
# @example
|
20
20
|
# Firewall.new(host: 'domain.com', port: 80)
|
21
21
|
# Firewall.new(host: 'domain.com', port: 80, timeout: 5)
|
22
|
-
# Firewall.new(
|
23
|
-
# Firewall.new(
|
22
|
+
# Firewall.new(url: 'https://domain.com')
|
23
|
+
# Firewall.new(url: 'https://domain.com', proxy: 'http://proxy.domain.com')
|
24
24
|
#
|
25
25
|
# @return [void]
|
26
26
|
def initialize(params)
|
data/lib/heartcheck/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heartcheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Locaweb
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -243,6 +243,7 @@ files:
|
|
243
243
|
- lib/heartcheck/controllers/functional.rb
|
244
244
|
- lib/heartcheck/controllers/health_check.rb
|
245
245
|
- lib/heartcheck/controllers/info.rb
|
246
|
+
- lib/heartcheck/controllers/inspect.rb
|
246
247
|
- lib/heartcheck/errors.rb
|
247
248
|
- lib/heartcheck/errors/routing_error.rb
|
248
249
|
- lib/heartcheck/errors/warning.rb
|
@@ -276,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
276
277
|
version: '0'
|
277
278
|
requirements: []
|
278
279
|
rubyforge_project:
|
279
|
-
rubygems_version: 2.
|
280
|
+
rubygems_version: 2.7.7
|
280
281
|
signing_key:
|
281
282
|
specification_version: 4
|
282
283
|
summary: A simple way to check if your app is runnig like as expected.
|