health-monitor-rails 9.1.0 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f17a76a7f5baaf094524cc1e1e4a3f6a967bffe1900540f9a68abadeee1fcab3
4
- data.tar.gz: 62d688b2f06bc54e727f9291937cbbb7ed706e5c02125596ac8b0193bdf3321f
3
+ metadata.gz: 858a66e2e4f657e91a804126dba76651043c68dda2ed5c0a8df47fcea21cb334
4
+ data.tar.gz: 03f963b3e3f58d156596118819ca63ddd10ef46dcbceec25e43f984c8da89ce8
5
5
  SHA512:
6
- metadata.gz: cf42a67607f30a3fc3cff87abeaad8a3c0dc84b29636890ae82d28aa464eadf52940bbbb2c9fbba385449abdfe81d4c5dab874a9f21c1fefaf81911a65f4b62e
7
- data.tar.gz: 71e8a6294d988401db16c78ecfb692c5579d3633cb2ebc783fa64d6ffd809ae6af75c4782c7f81038cc6e4156d6aa5b2de1b13344bdc6c61ace13f2fa38effb2
6
+ metadata.gz: 1b654622855555830de5c3b164c51ef65f564d9ad3a0139b9a5dfcb1a4620a34abb4aa9db80a0593d928cb7f7057cebd2e8ff5c2666c801d80b5c5f5bac01969
7
+ data.tar.gz: 060d96195cd80e37795ddd7d95b2c73654ee724518ba9e189fdc665d215ff37d30cb1997a59ebe1e0cc69fb0ac2f9672823435b05ca87f6308fb4f4b890bebe9
data/README.md CHANGED
@@ -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/example.png "HTML Status Page")
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 do
19
- render json: statuses.to_json, status: statuses[:status]
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
- <title>Status</title>
5
- <meta charset="utf-8">
6
- <meta name="viewport" content="width=device-width">
7
- <style type="text/css" media="screen">
8
- body {
9
- line-height: 2rem;
10
- font-family: sans;
11
- font-size: 14px;
12
- background-color: #f0f0f0;
13
- margin: 0;
14
- padding: 0;
15
- color: #000;
16
- text-align: center;
17
- }
18
-
19
- a { color: #333; }
20
-
21
- .container {
22
- width: 960px;
23
- margin: 20px auto;
24
- text-align: left;
25
- }
26
-
27
- h1 {
28
- font-weight: normal;
29
- line-height: 2.8rem;
30
- font-size: 30px;
31
- letter-spacing: -1px;
32
- text-align: center;
33
- color: #333;
34
- }
35
-
36
- .container {
37
- width: 960px;
38
- margin:40px auto;
39
- overflow: hidden;
40
- }
41
-
42
- .statuses {
43
- background: #FFF;
44
- width: 100%;
45
- border-radius: 5px;
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
- <% end %>
74
- </div>
75
- <div class="powered">
76
- Powered by <a href="https://github.com/lbeder/health-monitor-rails" target="_blank">health-monitor-rails</a>
77
- </div>
78
- </div>
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
- controller :health do
5
- get :check
6
- end
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 :error_callback, :basic_auth_credentials, :environment_variables
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HealthMonitor
4
- VERSION = '9.1.0'
4
+ VERSION = '9.2.0'
5
5
  end
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: 9.1.0
4
+ version: 9.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Beder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-24 00:00:00.000000000 Z
11
+ date: 2022-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties