health-monitor-rails 8.8.0 → 9.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -2
- data/app/controllers/health_monitor/health_controller.rb +3 -7
- data/app/views/health_monitor/health/check.html.erb +51 -75
- data/config/routes.rb +8 -3
- data/lib/health_monitor/configuration.rb +5 -3
- data/lib/health_monitor/monitor.rb +1 -1
- data/lib/health_monitor/providers/redis.rb +1 -1
- data/lib/health_monitor/version.rb +1 -1
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 858a66e2e4f657e91a804126dba76651043c68dda2ed5c0a8df47fcea21cb334
|
4
|
+
data.tar.gz: 03f963b3e3f58d156596118819ca63ddd10ef46dcbceec25e43f984c8da89ce8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b654622855555830de5c3b164c51ef65f564d9ad3a0139b9a5dfcb1a4620a34abb4aa9db80a0593d928cb7f7057cebd2e8ff5c2666c801d80b5c5f5bac01969
|
7
|
+
data.tar.gz: 060d96195cd80e37795ddd7d95b2c73654ee724518ba9e189fdc665d215ff37d30cb1997a59ebe1e0cc69fb0ac2f9672823435b05ca87f6308fb4f4b890bebe9
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# health-monitor-rails
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/health-monitor-rails.svg)](http://badge.fury.io/rb/health-monitor-rails)
|
4
|
-
[![Build Status](https://travis-ci.
|
4
|
+
[![Build Status](https://travis-ci.com/lbeder/health-monitor-rails.svg?branch=master)](https://travis-ci.com/lbeder/health-monitor-rails)
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/lbeder/health-monitor-rails/badge.svg)](https://coveralls.io/r/lbeder/health-monitor-rails)
|
6
6
|
|
7
7
|
This is a health monitoring Rails mountable plug-in, which checks various services (db, cache, sidekiq, redis, etc.).
|
@@ -14,7 +14,7 @@ You can filter which checks to run by passing a parameter called ```providers```
|
|
14
14
|
|
15
15
|
### HTML Status Page
|
16
16
|
|
17
|
-
![alt example](/docs/screenshots/
|
17
|
+
![alt example](/docs/screenshots/page.png "HTML Status Page")
|
18
18
|
|
19
19
|
### JSON Response
|
20
20
|
|
@@ -328,6 +328,18 @@ HealthMonitor.configure do |config|
|
|
328
328
|
end
|
329
329
|
```
|
330
330
|
|
331
|
+
### Customizing the path
|
332
|
+
|
333
|
+
By default, the endpoint where the status page is served is `/check`, but this can be customized:
|
334
|
+
|
335
|
+
```ruby
|
336
|
+
HealthMonitor.configure do |config|
|
337
|
+
config.path = :status
|
338
|
+
end
|
339
|
+
```
|
340
|
+
|
341
|
+
This will make the page to be served in the `/status` endpoint for instance (from where the engine was mounted).
|
342
|
+
|
331
343
|
### Monitoring Script
|
332
344
|
|
333
345
|
A Nagios/Shinken/Icinga/Icinga2 plugin is available in `extra` directory.
|
@@ -15,12 +15,8 @@ module HealthMonitor
|
|
15
15
|
|
16
16
|
respond_to do |format|
|
17
17
|
format.html
|
18
|
-
format.json
|
19
|
-
|
20
|
-
end
|
21
|
-
format.xml do
|
22
|
-
render xml: statuses.to_xml, status: statuses[:status]
|
23
|
-
end
|
18
|
+
format.json { render json: statuses.to_json, status: statuses[:status] }
|
19
|
+
format.xml { render xml: statuses.to_xml, status: statuses[:status] }
|
24
20
|
end
|
25
21
|
end
|
26
22
|
|
@@ -46,7 +42,7 @@ module HealthMonitor
|
|
46
42
|
end
|
47
43
|
|
48
44
|
def providers_params
|
49
|
-
params.permit(providers: [])
|
45
|
+
params.except(:format).permit(providers: [])
|
50
46
|
end
|
51
47
|
end
|
52
48
|
end
|
@@ -1,79 +1,55 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}
|
47
|
-
.statuses h1 { border-radius: 5px 5px 0 0; background: #f9f9f9; padding: 10px; border-bottom: 1px solid #eee;}
|
48
|
-
.statuses .status { font-size: 14px; border-bottom: 1px solid #eee; padding: 15px; }
|
49
|
-
.statuses .status:last-child { border-bottom: 0px; }
|
50
|
-
.statuses .name { font-size: 20px; margin-right: 20px; min-width: 100px; font-weight: bold; color: #555; }
|
51
|
-
.statuses .state { font-size: 14px; float: right; width: 80px; color: #45b81d; }
|
52
|
-
.statuses .message { color: #666; }
|
53
|
-
.statuses .timestamp { width: 130px; color: #999; }
|
54
|
-
.statuses .status-error .state { color: red; }
|
55
|
-
|
56
|
-
.powered { text-align: center; margin-top: 10px; color: #aaa; }
|
57
|
-
.powered a { color: #666; }
|
58
|
-
</style>
|
59
|
-
</head>
|
60
|
-
|
61
|
-
<body>
|
62
|
-
<div class="container">
|
63
|
-
<div class="statuses">
|
64
|
-
<h1>Status Page</h1>
|
65
|
-
<% @statuses[:results].each do |status| %>
|
66
|
-
<div class="status status-<%= status[:status].downcase %>">
|
67
|
-
<div class="status-heading">
|
68
|
-
<span class="name"><%= status[:name] %></span>
|
69
|
-
<span class="state"><%= status[:status] %></span>
|
3
|
+
<head>
|
4
|
+
<title>Status</title>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<meta name="viewport" content="width=device-width">
|
7
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
8
|
+
</head>
|
9
|
+
<body class="antialiased font-sans bg-gray-100">
|
10
|
+
<header class="bg-white shadow">
|
11
|
+
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
|
12
|
+
<h1 class="text-3xl font-bold text-gray-900 text-center">
|
13
|
+
Status Page
|
14
|
+
</h1>
|
15
|
+
</div>
|
16
|
+
</header>
|
17
|
+
<main>
|
18
|
+
<div class="max-w-7xl mx-auto py-12 sm:px-6 lg:px-8">
|
19
|
+
<div class="max-w-4xl mx-auto">
|
20
|
+
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
|
21
|
+
<div class="px-4 py-5 sm:px-6">
|
22
|
+
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
23
|
+
Services
|
24
|
+
</h3>
|
25
|
+
</div>
|
26
|
+
<div class="border-t border-gray-200">
|
27
|
+
<dl>
|
28
|
+
<% @statuses[:results].each_with_index do |status, index| %>
|
29
|
+
<div class="<%= index.odd? ? 'bg-gray-50' : 'bg-white' %> px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
30
|
+
<dt class="name text-sm font-medium text-gray-500">
|
31
|
+
<%= status[:name] %>
|
32
|
+
</dt>
|
33
|
+
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
|
34
|
+
<div class="state <%= 'text-red-600' if status[:status].downcase == 'error' %> font-bold">
|
35
|
+
<%= status[:status] %>
|
36
|
+
</div>
|
37
|
+
<% if !status[:message].empty? %>
|
38
|
+
<div class="message text-slate-600"><%= status[:message] %></div>
|
39
|
+
<% end %>
|
40
|
+
</dd>
|
41
|
+
</div>
|
42
|
+
<% end %>
|
43
|
+
</dl>
|
44
|
+
</div>
|
45
|
+
</div>
|
70
46
|
</div>
|
71
|
-
<div class="message"><%= status[:message] %></div>
|
72
47
|
</div>
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
</body>
|
48
|
+
</main>
|
49
|
+
<footer>
|
50
|
+
<div class="font-light text-center text-slate-500 text-xs px-5">
|
51
|
+
Powered by <a href="https://github.com/lbeder/health-monitor-rails" target="_blank">health-monitor-rails</a>
|
52
|
+
</div>
|
53
|
+
</footer>
|
54
|
+
</body>
|
55
|
+
</html>
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
HealthMonitor::Engine.routes.draw do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
path =
|
5
|
+
if HealthMonitor.configuration.path.present?
|
6
|
+
HealthMonitor.configuration.path
|
7
|
+
else
|
8
|
+
:check
|
9
|
+
end
|
10
|
+
|
11
|
+
get path, to: 'health#check'
|
7
12
|
end
|
@@ -4,7 +4,10 @@ module HealthMonitor
|
|
4
4
|
class Configuration
|
5
5
|
PROVIDERS = %i[cache database delayed_job redis resque sidekiq].freeze
|
6
6
|
|
7
|
-
attr_accessor :
|
7
|
+
attr_accessor :basic_auth_credentials,
|
8
|
+
:environment_variables,
|
9
|
+
:error_callback,
|
10
|
+
:path
|
8
11
|
attr_reader :providers
|
9
12
|
|
10
13
|
def initialize
|
@@ -24,8 +27,7 @@ module HealthMonitor
|
|
24
27
|
|
25
28
|
def add_custom_provider(custom_provider_class)
|
26
29
|
unless custom_provider_class < HealthMonitor::Providers::Base
|
27
|
-
raise ArgumentError.new 'custom provider class must implement '
|
28
|
-
'HealthMonitor::Providers::Base'
|
30
|
+
raise ArgumentError.new 'custom provider class must implement HealthMonitor::Providers::Base'
|
29
31
|
end
|
30
32
|
|
31
33
|
add_provider(custom_provider_class)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: health-monitor-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonid Beder
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: 1.1.0
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: 1.1.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: resque
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -276,8 +276,9 @@ files:
|
|
276
276
|
homepage: https://github.com/lbeder/health-monitor-rails
|
277
277
|
licenses:
|
278
278
|
- MIT
|
279
|
-
metadata:
|
280
|
-
|
279
|
+
metadata:
|
280
|
+
rubygems_mfa_required: 'true'
|
281
|
+
post_install_message:
|
281
282
|
rdoc_options: []
|
282
283
|
require_paths:
|
283
284
|
- lib
|
@@ -285,15 +286,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
285
286
|
requirements:
|
286
287
|
- - ">="
|
287
288
|
- !ruby/object:Gem::Version
|
288
|
-
version: '
|
289
|
+
version: '2.5'
|
289
290
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
290
291
|
requirements:
|
291
292
|
- - ">="
|
292
293
|
- !ruby/object:Gem::Version
|
293
294
|
version: '0'
|
294
295
|
requirements: []
|
295
|
-
rubygems_version: 3.
|
296
|
-
signing_key:
|
296
|
+
rubygems_version: 3.1.6
|
297
|
+
signing_key:
|
297
298
|
specification_version: 4
|
298
299
|
summary: Health monitoring Rails plug-in, which checks various services (db, cache,
|
299
300
|
sidekiq, redis, etc.)
|